Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why the heck does this not work

Status
Not open for further replies.

mspain

IS-IT--Management
Mar 17, 2002
100
US
Hi all,

I am having quite the frustrating problem here. All I want to do is popup a small window when my main page loads.

Here is what I have for the body tag

<body onload="popupNTN()" bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

The popupNTN is defined as:

<script LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function popupNTN() {
window.open(" return true
}
//-->
</script>

This is not working though! I don't understand. Firefox and IE are not reporting any type of javascript error. What am I doing wrong??

Thanks for the help!
 
None installed on IE and Firefox will say that it has blocked a popup and it is not showing that. Any other ideas?
 
Try changing this:

Code:
<script LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function popupNTN() {
    window.open("[URL unfurl="true"]http://www.betacenter.org/PopUp.html")[/URL]
    return true
}
//-->
</script>

to this:

Code:
<script type="text/javascript">
<!--
function popupNTN() {
	window.open('[URL unfurl="true"]http://www.betacenter.org/PopUp.html',[/URL] '', '');
	return (true);
}
//-->
</script>

Failing that, make sure you don't have any other code which is overwriting your onload, and do double-check you have disabled your popup blocker.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks, I gave that a try and it didn't work either.

I did try using onunload and that seemed to work so I know there is no problem with popups being block or the code being wrong so I would assume that something is overwriting the onload event. How can I go about cicumventing that?
 
Did you copy and paste your code in for us to see? The code BRPS and you showed should work without a problem.

Lee
 
I think I have solved it. There was an external javascript being included that had a line window.onload = function() { some function}. I set this function to call my popup as well and it seems to work.

This is a little confusing to me since my understanding is that the onload of the body tag should overwrite any window.onload, but that didn't seem to happen.

Either way it is working now. Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top