Nov 25, 2009

Select All Button

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Designing > Web Design and HTML

Select All Button

ginginca
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:
CODE

<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:
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

Comment/Reply (w/o sign-up)

WeaponX
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.

Comment/Reply (w/o sign-up)

TavoxPeru
QUOTE(ginginca @ Jan 15 2007, 03:02 PM) *

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:
CODE

<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:
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:

CODE

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


Best regards,

 

 

 


Comment/Reply (w/o sign-up)

ginginca
QUOTE(TavoxPeru @ Jan 15 2007, 06:55 PM) *

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:

CODE

<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!

Comment/Reply (w/o sign-up)

TavoxPeru
QUOTE(ginginca @ Jan 16 2007, 06:34 AM) *

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,

Comment/Reply (w/o sign-up)

FeedBacker
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

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)


See Also,

*SIMILAR VIDEOS*
Searching Video's for select, button
advertisement



Select All Button

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com