ginginca 0 Report post Posted January 15, 2007 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
WeaponX 0 Report post Posted January 15, 2007 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=7004It 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
TavoxPeru 0 Report post Posted January 15, 2007 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.GinAssuming 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
ginginca 0 Report post Posted January 16, 2007 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
TavoxPeru 0 Report post Posted January 16, 2007 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
iGuest 3 Report post Posted February 15, 2008 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