Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i change the form button value

Status
Not open for further replies.

Keendev

Technical User
Jan 23, 2006
106
PH
Hi,

need help on this one...

i wanted to change the button value from
Code:
<INPUT type="button" name="checkall"
value="Select all"  onClick="check_all( this.form['checkbox[]'], true )" >
into this one when clicked
Code:
<INPUT type="button" name="checkall"
value="Deselect all"  onClick="check_all( this.form['checkbox[]'], false )" >
and vice versa

as you can notice the button value changes when clicked and true becomes false and vice versa.

this is needed when you want to have select / deselect functionality.

thank you guys
 
Try this

Code:
<INPUT type="button" name="checkall"
value="Deselect all"  onClick="check_all( this.form['checkbox[]'], true, this )" >

<INPUT type="button" name="checkall"
value="Deselect all"  onClick="check_all( this.form['checkbox[]'], false, this )" >

in your JS
Code:
function check_all(group,action,node) {
  if (action) { node.value='Deselect All'; } else { node.value='Select All'; }

 .....

}

Notice that the JS is in addition to whatever you already do. Also, notice that the onclick="..." is simply passing the object reference in addition to whatever you had.

Hope this helps!




--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top