Hi ... I have three input types that are images. I need some help on creating a script that will change a form's action based upon which image is clicked. Please advise?
Jim Null
Jim Null
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<input type="image" onclick="this.form.action = 'whatever'; this.form.submit(); return false;" src="blah.jpg" />
<input type="image" onclick="this.form.action = 'whatever'; [!]this.form.submit();[/!] return false;" src="blah.jpg" />
<input type="image" onclick="this.form.action = 'whatever'; this.form.submit(); [!]return false;[/!]" src="blah.jpg" />
formObject.action=URL
<input type="image" onclick="document.formName.action = 'register.asp'; this.form.submit(); return false;" src="register.jpg" />
<input type="image" onclick="document.formName.action = 'login.asp'; this.form.submit(); return false;" src="login.jpg" />
<input type="image" onclick="document.formName.action = 'forgottenpassword.asp'; this.form.submit(); return false;" src="forgottenpassword.jpg" />
<html>
<head>
<script type="text/javascript">
function formSubmit()
{
document.getElementById("myForm").submit()
}
</script>
</head>
<body>
<a href="#" onclick="document.formName.action = 'forgottenpassword.asp'; formSubmit();">Forgotten Password</a>
...
<form method="post" action="">
<input type="image1" src="blahblah1.jpg">
<input type="image2" src="blahblah2.jpg">
<input type="image3" src="blahblah3.jpg">
<input type="image4" src="blahblah4.jpg">
</form>
<form method="post" action="?" name="userForm" id="userForm">
<input type="image" name="submit" id="go_1" src="go_there.jpg" value="" />
</form>
Happy to oblige! Could you post the code you have written to do this? We have the HTML - please post your javascript....I need some help on creating a script...
<form method="post" action="">
<input type="text" name="Test">
<input type="image1" src="blahblah1.jpg">
<input type="image2" src="blahblah2.jpg">
<input type="image3" src="blahblah3.jpg">
<input type="image4" src="blahblah4.jpg">
</form>
as I am looking for some Javascript to set the form action per the input type images