Search the web
Sign In
New User? Sign Up
honolulu-coders · Honolulu Coders
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Anyone Bored Enough To Look as Some Javascript?   Message List  
Reply | Forward Message #904 of 929 |
Hi,is anyone bored enough to tell my why this fails?

My index.htm page loads 'script.js':

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="../includes/script.js" />
</HEAD>
...

And 'script.js" has this function

function msgWin1(theURL,howWide,howHeigh,whereTop,whereLeft) {
var styleStr = "toolbar=no,scrollbars=yes,resizable=yes,fullscreen=no";
styleStr = styleStr + ",width=" + howWide;
styleStr = styleStr + ",height=" + howHeigh;
styleStr = styleStr + ",top=" + whereTop;
styleStr = styleStr + ",left=" + whereLeft;
var msgWindow1 = window.open(theURL,"msgWindow1", styleStr);
try{
msgWindow1.onload = function(){window.alert("YIPPEE");};
msgWindow1.count=8;
msgWindow1.onload();
msgWindow1.focus();
} catch (err) {
window.alert("ERROR: END");
}
}

I have an onclick in the index page that a user can call to open a second
window and load another page -- "theURL"

The HTML code for the new page in the second window is:

<HTML>
<HEAD>
<LINK href="../css/style.css" type=text/css rel=stylesheet>
<SCRIPT type=text/javascript>
window.alert(this.count);
window.alert(null == this.onload);
window.alert(typeof(this.onload));
</SCRIPT>
</HEAD>
....

Here's the problem.

When the first widow calls msgWin1() it does execute:
msgWindow1.onload()
That does open an alert window with "YIPPEE" in it.

Then, the script in the second window's HEAD uses alert() to:

1. Confirm the this.count property still equals 8

BUT

2. Claims this.onload is null (with typeof 'object' instead of 'fundtion')

How did I keep the msgWindow1.count property, but lost the msgWindow1.onload
function???

Thanx
GLB






Mon Mar 23, 2009 2:21 am

piikoicoder
Offline Offline
Send Email Send Email

Forward
Message #904 of 929 |
Expand Messages Author Sort by Date

Hi,is anyone bored enough to tell my why this fails? My index.htm page loads 'script.js': <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html;...
piikoicoder
Offline Send Email
Mar 23, 2009
2:21 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help