473,385 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Mozilla 1.5 can't create a window from onLoad event in <body> tag?

I've been running some small test programs which seem to indicate
something noticed in a larger script, that a function called from
onLoad() in the <body> tag will not succeed in creating a window
(i.e. successfully executing window.open() in Mozilla 1.5; however,
I've observed it to work a few times in IE 6.0 and Opera 5.something.
It does not seem to be a timing thing -- if I re-call the function
somewhat later using setTimeout it still doesn't succeed. However,
a call to the same function from a link (a href=...) does succeed.
I'm wondering if I've overlooked something in the documentation.

The shortest of the tests:
-----------------------------------------------------------------
<html>
<head>
<title>x</title>
<script language="JavaScript1.2" type="text/javascript">
var k = 0;
var m = 'w1.<br>';
var w1;

function initz() {
k += 1;
if (w1) {
m += k + ": already here! ";
} else {
m += k + ": opening... ";
w1 = window.open(" ", "w1",
"toolbar=no,status=yes,height=400,width=400,menuba r=yes,scrollbars=yes,resizable=yes,directories=no, location=no");
}

if (!w1) {
m += k + ": not here.... ";
} else {
m += k + ": here! ";
w1.document.write("m=" + m + "<br>");
}
}
</script>
</head>

<body bgcolor='#53438F' text='#ffff00' link='#ff0000' vlink='#cc0000'
onload='javascript:initz()'>
<a href='javascript:initz()'>
xxx</a>
</body>
</html>
-----------------------------------------------------------------

which, when the link is clicked on, brings up a window with
the following text:

m=w1.
1: opening... 1: not here.... 2: opening... 2: here!
Jul 20 '05 #1
2 1468
DU
Starry Gordon wrote:

[snipped]

a function called from
onLoad() in the <body> tag will not succeed in creating a window


[snipped]

Thank god I don't have to endure such poor webpage design anymore: I
block unrequested popups and so do millions of others using browsers (or
add-ons) suppressing such nonsense.

DU
Jul 20 '05 #2
"Starry Gordon" <st**********@etaoin.com> wrote in message
news:bc**************************@posting.google.c om...
I've been running some small test programs which seem to indicate
something noticed in a larger script, that a function called from
onLoad() in the <body> tag will not succeed in creating a window
(i.e. successfully executing window.open() in Mozilla 1.5; however,
I've observed it to work a few times in IE 6.0 and Opera 5.something.
It does not seem to be a timing thing -- if I re-call the function
somewhat later using setTimeout it still doesn't succeed. However,
a call to the same function from a link (a href=...) does succeed.
I'm wondering if I've overlooked something in the documentation.


It could just be that Mozilla is blocking pop-ups? I believe it does this
by default unless you configure it to do otherwise.
--
Dave Ockwell-Jenner
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andrés Giraldo | last post by:
Hi! It's possible to register some script between the <head> and </head> actually I'm Using RegisterStartupScript and RegisterClientBlockScript, but it works on the body By the way... how...
1
by: Dung Ping | last post by:
For instance, one set is: <body onload="blinking_header()" onunload="stoptimer()"> Another set is: <body onload="writemsg()" onunload="stoptimer()"> They represent two functions. How to...
9
by: bmgz | last post by:
I need to execute a JavaScript function "onload". The only problem is I don not have access to the <body> tag as it is a part of the standard page-header include (a separate file). How could I have...
3
by: francescomoi | last post by:
Hi. I'm trying to insert some text between <head> and <body> but I'm not able. I try with: -------- bodyPoint = document.getElementsByTagName('body'); var myLink =...
15
by: Frances | last post by:
<html> <head> <script> function doIt() { var list = document.forms.product; var selItem = list.options.value; ^^^^^^^ </head>
9
by: tomcadman | last post by:
Using Javascript, how do I give focus to a form text box on page load without using the <body> tag? Thanks!
2
mickey0
by: mickey0 | last post by:
HI, is it possible to do this? I'd like at first execute the ONE and then the TWO. Will it work? <body onload="func1()","func2()"> </body>
8
by: Prisoner at War | last post by:
Another weekend, another project, another problem.... Why should a perfectly fine function work only half-way through when called through onClick in an anchor tag?? The text fade-in script...
23
by: Xah | last post by:
Here's a interesting case of invalid html 4 strict file. In summary, if you have <body></bodywithout any content, the file would be invalid under html 4 strict. Valid if html 4 lose. <!DOCTYPE...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.