I have a php page that creates forms (many on each page) with dynamically named parts.
So each form and the submit button is uniquely named.
What I want to be able to do is have the following javascript function run at the click of the button. So I need to pass the form & button name. I can do that, but I can't get the javascript to do the next thing. What I want to do is change the text(value) on the button.
This will work for 1 form.
<script type="text/javascript">
function valChange() {
document.myForm.myButton.value="Value has changed"
}
</script>
I can have the OnClick dynamically written for each button like this:
One may look like this: onClick="valChange( myForm, myButton );"
The next will look like this: onClick="valChange( yourForm, yourButton );"
How do I get it to use the variables that I am passing?
function valChange(theForm, theButton) {
How do I build the line below using the 2 variables I passed?
document.myForm.myButton.value="Value has changed"
}
I know this is something stupid that I'm not doing, but I've got a mental block on this problem now.
I appreciate any help you can give me.
Jeni
So each form and the submit button is uniquely named.
What I want to be able to do is have the following javascript function run at the click of the button. So I need to pass the form & button name. I can do that, but I can't get the javascript to do the next thing. What I want to do is change the text(value) on the button.
This will work for 1 form.
<script type="text/javascript">
function valChange() {
document.myForm.myButton.value="Value has changed"
}
</script>
I can have the OnClick dynamically written for each button like this:
One may look like this: onClick="valChange( myForm, myButton );"
The next will look like this: onClick="valChange( yourForm, yourButton );"
How do I get it to use the variables that I am passing?
function valChange(theForm, theButton) {
How do I build the line below using the 2 variables I passed?
document.myForm.myButton.value="Value has changed"
}
I know this is something stupid that I'm not doing, but I've got a mental block on this problem now.
I appreciate any help you can give me.
Jeni