Netscape suports the onClick event i think the image name is
not suported under Netscape.
So instead of
function
act(num,imgName){
if (getAppVersion()){
document[imgName].src =img[num].src;
}
if (getAppVersion()){
document[imgName].src =img[num].src;
}
put something like
this:
function
act(num,imgIndex){
if (getAppVersion()){
document.images[imgIndex].src =img[num].src;
}
if (getAppVersion()){
document.images[imgIndex].src =img[num].src;
}
where imgIndex should be a number
indicating that the current image's order
in document. (i mean thr first =0 second=1
third=2)
Best wishes,
Andras
-----Original Message-----
From: Alvin, lau <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, June 03, 1999 6:34 PM
Subject: javascript, ie and netscapehi,Can anyone tell me that how can I make the following code work on IE and netscape.(It works with IE, but not netscape. I think <img> doesn't have "onclick" event in netscape, so what can I do?)<html><head>
....<script lauguage="javascript">function getAppVersion(){
appname=navigator.appName;
appversion=navigator.appVersion;
majorver=appversion.substring(0,1);
if((appname=="Netscape")&&(majorver<3)) return 0;
if((appname=="Microsoft Internet Explore")&&(majorver<4)) return 0;
return 1;
}
imgsrc=new Array();imgsrc[0]="images/back.gif";
imgsrc[1]="images/back1.gif";if(getAppVersion()){
img=new Array();
for(i=0;i<imgsrc.length;i++){
img[i]=new Image();
img[i].src=imgsrc[i];
}
}function act(num,imgName){
if (getAppVersion()){
document[imgName].src =img[num].src;
}
}</script></head>.....<p align="center"><img name="back" src="images/back1.gif" width="153" height="31" onmouseover="act('0','back')" onmouseout="act('1','back')" onclick="history.back()"></p></body>
</html>thankxalvin
