Jump to content
xisto Community
ginginca

Select All Button

Recommended Posts

I have an HTML question.

I have two boxes on a page and plan to add a few more.

The first box contains a block of HTML code and a SELECT ALL button at the bottom, using this line of cide:

<input name="button" type="button" onclick="document.form_code.code.select()" value="Select All" />

It works fine.

My second box has a similar line of code:
<input name="button2" type="button" onclick="document.form_code.code.select()" value="Select All" />

But when I click THAT one, it still selects the cide in my FIRST box. Can anyone help?

Thanks.

Gin

Share this post


Link to post
Share on other sites

Hi Gin, you might want to give your text boxes a different name or use the textarea html tag instead. I never used it myself before but this site shows you how to use it:

http://www.codeave.com/javascript/code.asp?u_log=7004

It will basically be using a specific name that you can reference it to so the selection only applies to the text you want.

Share this post


Link to post
Share on other sites

I have an HTML question.
I have two boxes on a page and plan to add a few more.

The first box contains a block of HTML code and a SELECT ALL button at the bottom, using this line of cide:

<input name="button" type="button" onclick="document.form_code.code.select()" value="Select All" />

It works fine.

My second box has a similar line of code:
<input name="button2" type="button" onclick="document.form_code.code.select()" value="Select All" />

But when I click THAT one, it still selects the cide in my FIRST box. Can anyone help?

Thanks.

Gin
Assuming that your first SELECT ALL button selects all the text inside an input box or textarea named code and that your second SELECT ALL button selects all the text inside an another input box or textarea named code2 simply change the name of the second box in your code like this:

<input name="button2" type="button" onclick="document.form_code.code2.select()" value="Select All" />

Best regards,

Share this post


Link to post
Share on other sites

Assuming that your first SELECT ALL button selects all the text inside an input box or textarea named code and that your second SELECT ALL button selects all the text inside an another input box or textarea named code2 simply change the name of the second box in your code like this:

<input name="button2" type="button" onclick="document.form_code.code2.select()" value="Select All" />

Best regards,

Aha! you're seeing something that I didn't. I'll give that a look.

Thanks.

Yes, that's it. THANKS!

Share this post


Link to post
Share on other sites

Aha! you're seeing something that I didn't. I'll give that a look.
Thanks.

Yes, that's it. THANKS!

You are welcome, BTW, if you plan to include more boxes i think that a good option is to create a simple javascript function that receives the name of the input box or textarea as a parameter of it. This function will be very generic and could be used in any page that you need this functionality.

Let me know if you want it and you don't know how to do code it to give you a hand.

Best regards,

Share this post


Link to post
Share on other sites

to get the value of the selected button on onclick

Select All Button

 

Haiiii...

 

How to get the value of the selected button on onclick in javascript /

 

The code is...

 

<INPUT TYPE=BUTTON id="+" onclick="getButton();" ><%=+%>

 

Pls help mee

 

-ajith

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.