Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Select All Button
ginginca
post Jan 15 2007, 08:02 PM
Post #1


Premium Member
Group Icon

Group: Members
Posts: 250
Joined: 6-July 06
From: The net (or at least that's what my family says)
Member No.: 14,330



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
Go to the top of the page
 
+Quote Post
WeaponX
post Jan 15 2007, 08:21 PM
Post #2


Way Out Of Control - You need a life :)
Group Icon

Group: Members
Posts: 1,086
Joined: 21-June 05
From: New York
Member No.: 6,440



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.
Go to the top of the page
 
+Quote Post
TavoxPeru
post Jan 15 2007, 11:55 PM
Post #3


Super Member
Group Icon

Group: [HOSTED]
Posts: 750
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579



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,
Go to the top of the page
 
+Quote Post
ginginca
post Jan 16 2007, 11:34 AM
Post #4


Premium Member
Group Icon

Group: Members
Posts: 250
Joined: 6-July 06
From: The net (or at least that's what my family says)
Member No.: 14,330



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!
Go to the top of the page
 
+Quote Post
TavoxPeru
post Jan 16 2007, 11:06 PM
Post #5


Super Member
Group Icon

Group: [HOSTED]
Posts: 750
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579



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,
Go to the top of the page
 
+Quote Post
iGuest
post Feb 15 2008, 07:35 AM
Post #6


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics


 



- Lo-Fi Version Time is now: 8th September 2008 - 06:48 AM