|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a form that is to be submitted by clicking on one of 2 images. When clicked on the first, JavaScript "A" needs to be run.
Script "B" then needs to be run in either case before submitting. This following works with IE, but not with Netscape which ignores the onClick. Any suggestions welcome! <HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> //<!-- function chk(){alert("clicked");}//"A" stuff function sub() {alert("submit");}//"B" stuff //--> </SCRIPT> </HEAD> <BODY> <FORM onSubmit="return sub()"> <INPUT type=image name="button1" src="images/yes.gif" onClick="chk();return true;"> <INPUT type=image name="button2" src="images/no.gif"> </FORM></BODY></HTML> |
|
#2
|
|||
|
|||
|
This is an alternative
NN2/3/4 (and likely IE3) don't support onclick for INPUT TYPE="image" elements. As a workaround you can use a link with an image contained that is instead of <INPUT TYPE="image" SRC="whatever.gif" ONCLICK="if (...) return true; else return false; " > you use <A HREF="javascript: void 0" ONCLICK="if (...) document.formName.submit(); return false; " ><IMG SRC="whatever.gif" BORDER="0"></A> |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > input type=image onClick doesn't work in Netscape |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|