In the following code, I have 2 questions regarding submit button with image.
1) Does this code <input type="image" name="populate" src="populate.g if">
behave the same as an HTML submit button with image populate.gif?
When I click p1 or p2 button, it will post the page to process.asp.
2) When I check the checkbox, I want the image in submit button change
from populate.gif to validate.gif. Unfortunately, the code
InputForm.p2.sr c = "validate.g if"; doesn't work. But
InputForm.p1.va lue = "validate button"; is working for a regular HTML submit
button.
Any workarounds? Please advise. Thanks!!
<html>
<head>
<script type="text/javascript">
function cb_onClick()
{ if (InputForm.C1.c hecked == true) //NOT InputForm.C1.va lue == "on"
{
InputForm.p1.va lue = "validate button";
InputForm.p2.sr c = "validate.g if";
}
else
{
InputForm.p1.va lue = "populate button";
InputForm.p2.sr c = "populate.g if";
}
}
</script>
</head>
<body>
<form name="InputForm " method="POST" action="process .asp">
<p><input type="checkbox" name="C1" onClick="cb_onC lick()"></p>
<p><input type="submit" name="p1" value="populate button">
<p><input type="image" name="p2" src="populate.g if">
</form>
</body>
</html>
1) Does this code <input type="image" name="populate" src="populate.g if">
behave the same as an HTML submit button with image populate.gif?
When I click p1 or p2 button, it will post the page to process.asp.
2) When I check the checkbox, I want the image in submit button change
from populate.gif to validate.gif. Unfortunately, the code
InputForm.p2.sr c = "validate.g if"; doesn't work. But
InputForm.p1.va lue = "validate button"; is working for a regular HTML submit
button.
Any workarounds? Please advise. Thanks!!
<html>
<head>
<script type="text/javascript">
function cb_onClick()
{ if (InputForm.C1.c hecked == true) //NOT InputForm.C1.va lue == "on"
{
InputForm.p1.va lue = "validate button";
InputForm.p2.sr c = "validate.g if";
}
else
{
InputForm.p1.va lue = "populate button";
InputForm.p2.sr c = "populate.g if";
}
}
</script>
</head>
<body>
<form name="InputForm " method="POST" action="process .asp">
<p><input type="checkbox" name="C1" onClick="cb_onC lick()"></p>
<p><input type="submit" name="p1" value="populate button">
<p><input type="image" name="p2" src="populate.g if">
</form>
</body>
</html>
Comment