|
|
|
|
![]() ![]() |
Jan 15 2007, 08:02 PM
Post
#1
|
|
|
Premium Member 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 |
|
|
|
Jan 15 2007, 08:21 PM
Post
#2
|
|
|
Way Out Of Control - You need a life :) 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. |
|
|
|
Jan 15 2007, 11:55 PM
Post
#3
|
|
|
Super Member Group: [HOSTED] Posts: 750 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 |
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, |
|
|
|
Jan 16 2007, 11:34 AM
Post
#4
|
|
|
Premium Member Group: Members Posts: 250 Joined: 6-July 06 From: The net (or at least that's what my family says) Member No.: 14,330 |
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! |
|
|
|
Jan 16 2007, 11:06 PM
Post
#5
|
|
|
Super Member Group: [HOSTED] Posts: 750 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 |
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, |
|
|
|
Feb 15 2008, 07:35 AM
Post
#6
|
|
|
Newbie [ Level 1 ] 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 |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
Lo-Fi Version | Time is now: 8th September 2008 - 06:48 AM |