473,385 Members | 1,317 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.

Opening new window and writing to it on Firefox 1.5 does not complete

Hello:

I'm stuck with a small problem using windows created using
javascript.
Here's the code of the html file.

------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Today's Date</title>
<script type="text/javascript">
function print_todays_date() {
var d = new Date(); // get today's date.
document.write(d.toLocaleString());
}
</script>
</head>
<body>
The date and time are: <br/>
<script type="text/javascript">print_todays_date();</script>
<script type="text/javascript">
w1 = window.open();
w1.document.write("Hello World");
</script>
</body>
</html>
------------------------------------------------------------------------------------------------------

Now in the above when i load the html page in FF 1.5 the date is
printed fine.
Also, a new window is opened with the text "Hello World", but the
window
cursor for the new window shows the the document is not loaded
completely.
Also, there's a partial blue bar at the bottom right of the new window
indicating
the page is not loaded completely.

I'd appreciate if anyone can point to the problem as to why the new
window
does not finish loading completely ?

Thanks a lot in advance.

Yashesh Bhatia

Jan 16 '07 #1
5 2245
ASM
Yashesh Bhatia a écrit :
Also, a new window is opened with the text "Hello World", but the
window
cursor for the new window shows the the document is not loaded
completely.
<script type="text/javascript">
w1 = window.open();
w1.document.open();
w1.document.write("Hello World");
w1.document.close(); // stops navigator waiting more loading
</script>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 16 '07 #2
dd
You're missing a document.close();

Jan 16 '07 #3
Lee
Yashesh Bhatia said:

If you open it, close it.
Also note that there's no guarantee that a new window will
have a document object to write into so soon after the open()
call:
>------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Today's Date</title>
<script type="text/javascript">
function print_todays_date() {
var d = new Date(); // get today's date.
document.write(d.toLocaleString());
}
</script>
</head>
<body>
The date and time are: <br/>
<script type="text/javascript">print_todays_date();</script>
<script type="text/javascript">
w1 = window.open();
w1.document.write("Hello World");
w1.document.close();
</script>
</body>
</html>
-

--

Jan 16 '07 #4
Lee said the following on 1/16/2007 10:12 AM:
Yashesh Bhatia said:

If you open it, close it.
Also note that there's no guarantee that a new window will
have a document object to write into so soon after the open()
call:
Along with:

There is no guarantee that a call to window.open that is not user
initiated (as in this instance) will even result in a new window.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 16 '07 #5
dd

Randy Webb wrote:
There is no guarantee that a call to window.open that is not user
initiated (as in this instance) will even result in a new window.
I see this sooooo many times out in the wild. People get a
handle to a new popup and don't check whether it exists
before trying to use it. It's one of the downfalls of always
having IE set to show the debug dialog.

Popup blockers people - get used to them.

Jan 17 '07 #6

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

Similar topics

44
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the...
9
by: Karel | last post by:
All, I am completely new to Javascript but I have read some articles and examples about opening new windows from a webpage. However I am trying to open a data file ( in html format) that is...
5
by: GEL | last post by:
Hi, I want to open a new browser window, let the user use that window for several minutes, and when they close, I'd like to change the page displayed in the original window. According to...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
2
by: Keshav Gadia | last post by:
Hi, I am an ASP.net newbie. I am writing a user control that is made up of datagrid with one of the columns opening a new window to display some details on click of the set image. I have...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
5
by: Roger Withnell | last post by:
This is a framed webpage with the navigation bar in "NavBar" and the main window in "Main". When opening a new page in "Main" from "NavBar" with: function OpenFrameWindow(src) { var...
44
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute...
1
by: OtisUsenet | last post by:
Hello, I have some onClick events in <a href...> elements, so they get called when a user clicks on a link. This works well, and looks like this: <a onclick="onLinkClick(123);"...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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.