View Full Version : changing value of button when button name is stored in string
cooldude_i06
10-03-2004, 04:00 AM
hi, could someone tell me how i can change the value of a button when the name of the button is stored in a string. my script doesnt use a form (or atleast i dont create one). thanks
jamescover
10-03-2004, 05:17 AM
hi, could someone tell me how i can change the value of a button when the name of the button is stored in a string. my script doesnt use a form (or atleast i dont create one). thanks
Hi:
First, welcome to the forum!
Second, what script? Please, post the script in question.
-james
ez4ne12c
10-03-2004, 05:21 AM
<input type='button' value='fred' id='fred_button' onMouseover='change_button()'>
...
...
...
<script>
function change_button()
{ var my_string='freds new name';
document.getElementById("fred_button").value = my_string;
alert (document.getElementById("fred_button").value )
}
</script>
ez
jamescover
10-03-2004, 06:00 AM
hi, could someone tell me how i can change the value of a button when the name of the button is stored in a string. my script doesnt use a form (or atleast i dont create one). thanks
If you mean, how to make a button without a form:
http://www.w3schools.com/tags/tag_button.asp
-james
cooldude_i06
10-03-2004, 06:13 PM
thanks ez4ne12c, i was looking for the getElementByID function, thanks
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.