When do things like this:
<form id="formtest" action="#">
<p>
<input id="buttontest" type="button" name="testbutton" value="Button Test"
onclick="testingButton(this.form)" />
what needs to passed is: this.form
For the called fuction (this case testingButton),
do it like thie:
function testingButton(note) {
alert(note.testbutton.value);
It will print, Button Test
Above won't work for multiple inputs.
For multiple inputs, do this:
<form id="formtest" action="#">
<p>
<input id="buttontest" type="button" name="testbutton" value="Button Test"
onclick="testingButton('test')" />
For the called fuction, do it like this:
<script type="text/javascript">
function testingButton(note) {
if (note == 'test') {
alert "here! 2");
}
.
No comments:
Post a Comment