Forum Moderators: open
Here's the JS:
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'";
if (restore) selObj.selectedIndex=0;
}
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?")>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->
</script>
And the HTML:
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="mailto:general_info@cfcintl.com" selected>US</option>
<option value="mailto:general_info@cfcoeser.com">Europe</option>
<option value="mailto:general_info@cfcintl.co.jp">Asia</option>
</select>
<input type="button" name="Button1" value="Go" onClick="MM_jumpMenuGo('menu1','parent',0)">
The problem seems to be in the Javascript -- it's missing some close parens -- apparently Explorer forgives this but Netscape doesn't.
Try this fix. Add a ) immediately before the semicolon at the end of line 4 so it reads:
.value+"'");
Also add another ) at the end of line 9 so it reads:
parent.frames.length)) {
For your future debug efforts in Netscape, when the code doesn't run, type javascript: (the colon is important) into the Netscape location window and press enter. They've been nice enough to include a javascript console in Netscape that often helps locate the problem.
Also, I'm assuming that your HTML snippet occurs inside a <form></form>. Forgetting the form tags is another place where Explorer will sometimes forgive your code, but Netscape won't.
Even though extra spaces are "supposed to be" ignored in JavaScript, there are places where Netscape will choke if you include a space. A good example of this is when you use JavaScript to open a new window, and then list all the attributes you want the window to have, like status bar, location bar, scrolling, and so on.
If you include a space anywhere in that list, Netscape just won't cooperate.
It seems funny that Netscape, the creator of JavaScript, has this bug -- but Explorer, who really runs something proprietary that they call jscript, ends up supporting the JavaScript standard more exactly ... at least in this case.
Learned that one the hard way. Spent about, hate to admit it, 3 hours of banging me head on the desk.
Brian