Re: Need some help with some JavaScript

Subject: Re: Need some help with some JavaScript
From: Chuck Martin <cm -at- writeforyou -dot- com>
To: "TECHWR-L" <techwr-l -at- lists -dot- techwr-l -dot- com>
Date: Mon, 13 Dec 2004 10:18:35 -0800


PD -dot- Lees -at- btinternet -dot- com wrote:

Chuck,


I'm trying to figure out why this code works fine in Firefox (1.0) but
causes an error in Internet Explorer (6.0).

[SNIPPED]

And this is in the BODY tags:

<p>Click <a href=""
onclick="helpwin('GoalView%20Help/WebHelp/GoalView_Help.htm',
'GoalView Help');">Help</a> to view the help. </p>


I think the space character in the second parameter ("GoalView Help") is
causing the problem. If you remove this, the script seems to work fine.


You're righht about that parameter. However, changing it still makes no difference. I've been tweaking the code, trying simpler and simpler versions (as you can see from the demos below), and it's still not working on IE.

Here's the latest sample:

<script language="JavaScript1.4">
<!--
function helpWindow(u, n) {
var upperLeft = (screen.availWidth / 2);
var winHeight = (screen.availHeight / 2);
var w = (screen.availWidth / 2);
var win = window.open(u, n, 'toolbar=no,status=no,menubar=no,width=' + w + ',height=' + winHeight + ',left=' + upperLeft + ',top=0');
//var win = window.open(u, n, "toolbar=no,status=no,menubar=no");
//var helpwin = window.open(u, n);
}

//myWindow = window.open("", "tinyWindow", 'toolbar,width=150,height=100')
//myWindow.document.write("Welcome to this new window!")
//myWindow.document.bgColor="lightblue"

// This function was copied from a JavaScript site and
// I'm using it for testing purposes.
function changeURL(winName, newURL) {
win = window.open("", winName);
win.location.href = newURL;
}


-->
</script>


<p>This page is intended to demonstate an HTML-based Help system possibility for GoalView.</p>
<p>Click <a href="" onclick="javascript:helpWindow('WebHelp/GoalView_Help.htm', 'Help');">Help</a> to view the help. </p>
<p>Click <a href="" onclick="javascript:window.open('WebHelp/GoalView_Help.htm', 'Help', 'toolbar=no,status=no,menubar=no,width=600,height=500,left=0,top=0');">Help</a> to view the help. </p>
<p>Click <a href="" onclick="javascript:window.open('WebHelp/GoalView_Help.htm', 'Help');">Help</a> to view the help. </p>
<FORM>
<INPUT TYPE="button" VALUE="Help" onClick="helpWindow('WebHelp/GoalView_Help.htm', 'Help')">
<INPUT TYPE="button" VALUE="Help" onClick="window.open('WebHelp/GoalView_Help.htm', 'Help')">
<INPUT TYPE="button" VALUE="Load ZDNet" onClick="changeURL('news', 'http://www.zdnet.com/')">
<INPUT TYPE="button" VALUE="Load ZDNet" onClick="window.open('http://www.zdnet.com/', 'news')">
</FORM>

As far as the buttons go, the second pair uses for the first button the exact code copied from the JavaScript site (the second one with modified code for a baseline), in both pairs, the first gives an "object expected" error.

I found too, that this problem occurs on 2 different machines. In both cases, the error occurs in IE, but not FireFox. (Adding SP2 added an additional set of issues regarding active content and pop-ups, but that's a horse of a different color.)

These functions, bot the one I wrote and the one that i snagged from the JavaScript site, *should* be doing the exact same thing as the inline code. But the funciton fails and the inline code works. Does anyone know why?

Note: many line breaks in this message were likely added by the user agent used to post this message. Assume well formatted code.

--
--
Chuck Martin
User Assistance & Experience Engineer
twriter "at" sonic "dot" net www.writeforyou.com

"I see in your eyes the same fear that would take the heart of me.
The day may come when the courage of Men fail, when we forsake our
friends and break all bonds of fellowship. But it is not this day!
This day, we fight!"
- Aragorn

"All you have to decide is what to do with the time that is given you."
- Gandalf

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ROBOHELP X5 - SEE THE ALL NEW ROBOHELP X5 IN ACTION!

RoboHelp X5 is a giant leap forward in Help authoring technology, featuring all new Word 2003 support, Content Management, Multi-Author support, PDF and XML support and much more! View an online demo: http://www.macromedia.com/go/techwrldemo

---
You are currently subscribed to techwr-l as:
archiver -at- techwr-l -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- techwr-l -dot- com
Send administrative questions to lisa -at- techwr-l -dot- com -dot- Visit
http://www.techwr-l.com/techwhirl/ for more resources and info.



Previous by Author: Need some help with some JavaScript
Next by Author: Re: Opinions requested regarding new web utility
Previous by Thread: Re: Need some help with some JavaScript
Next by Thread: Re: Need some help with some JavaScript


What this post helpful? Share it with friends and colleagues:


Sponsored Ads