HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 23rd, 1999, 01:52 PM
tpchai
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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>

Reply With Quote
  #2  
Old August 8th, 2000, 01:04 PM
tpchai tpchai is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Location: Toronto, ON, Canada
Posts: 1 tpchai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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>

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > input type=image onClick doesn't work in Netscape


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway