The problem is I have 3 buttons that need to submit the form to different
URL.
My approach is to declare <input type="submit"> rather than <input
type="button">.
And put the following in the JavaScript:
InputForm.actio n="URL LOCATION"
InputForm.metho d="POST";
I think we don't need InputForm.submi t(); because <input type="submit">.
Please advise and comment my approaches. Thanks!!
=============== =============== =============== =
<html>
<head>
<script type="text/javascript">
function onClickURL1()
{ InputForm.actio n="url1.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL2()
{ InputForm.actio n="url2.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL3()
{ InputForm.actio n="url3.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
</script>
</head>
<body>
<form name="InputForm ">
<P><input type="text" name="username" >
<P><INPUT type="submit" value="submit form data to URL1" name="action1"
onclick="onClic kURL1()">
<P><INPUT type="submit" value="submit form data to URL2" name="action2"
onclick="onClic kURL2()">
<P><INPUT type="submit" value="submit form data to URL3" name="action3"
onclick="onClic kURL3()">
</form>
</body>
</html>
URL.
My approach is to declare <input type="submit"> rather than <input
type="button">.
And put the following in the JavaScript:
InputForm.actio n="URL LOCATION"
InputForm.metho d="POST";
I think we don't need InputForm.submi t(); because <input type="submit">.
Please advise and comment my approaches. Thanks!!
=============== =============== =============== =
<html>
<head>
<script type="text/javascript">
function onClickURL1()
{ InputForm.actio n="url1.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL2()
{ InputForm.actio n="url2.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
function onClickURL3()
{ InputForm.actio n="url3.asp"
InputForm.metho d="POST";
//InputForm.submi t(); //NOT NECESSARY!! because of input type="submit"??
}
</script>
</head>
<body>
<form name="InputForm ">
<P><input type="text" name="username" >
<P><INPUT type="submit" value="submit form data to URL1" name="action1"
onclick="onClic kURL1()">
<P><INPUT type="submit" value="submit form data to URL2" name="action2"
onclick="onClic kURL2()">
<P><INPUT type="submit" value="submit form data to URL3" name="action3"
onclick="onClic kURL3()">
</form>
</body>
</html>
Comment