homepage Welcome to WebmasterWorld Guest from 54.237.38.30
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Prob w/ Netscape & Dreamweaver JavaScript
Any help?
akaTigger

10+ Year Member



 
Msg#: 626 posted 8:00 pm on Nov 16, 2000 (gmt 0)

I've used Dreamweaver to provide a menu list for email contact choices, which is not working in Netscape 4.75. Dreamweave automatically adds the necessary JavaScript, and I don't know enough JS to debug the problem. Anyone have experience with this? Thanks.

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)">

 

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 626 posted 11:38 pm on Nov 16, 2000 (gmt 0)

Hello, akaTigger. Good to have you on the Forums.

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.

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 626 posted 11:54 pm on Nov 16, 2000 (gmt 0)

This thread's probably a good place to mention another big difference between Netscape's JavaScript implementation and Explorer's.

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.

akaTigger

10+ Year Member



 
Msg#: 626 posted 12:14 am on Nov 17, 2000 (gmt 0)

Tedster,

Thanks for the help & the welcome. I only recently found the forums. What a GREAT time & headache-saving resource!

The parens were actually in the script (just didn't copy over somehow), but I had not included the <form> tags. I corrected that, and it works fine. Thanks again.

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 626 posted 12:18 am on Nov 17, 2000 (gmt 0)

It's good to know that Dreamweaver doesn't forget to close their brackets!

GWJ



 
Msg#: 626 posted 3:23 pm on Nov 17, 2000 (gmt 0)

>If you include a space anywhere in that list, Netscape just won't cooperate.

Learned that one the hard way. Spent about, hate to admit it, 3 hours of banging me head on the desk.

Brian

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved