473,387 Members | 3,684 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,387 software developers and data experts.

Please! help me out with this (its urgent)

Hi,

Is there any one who could help me to execute the following code
correctly.

<html>
<head>
<title>Some Title</title>
<script>
win=window.open('',null,'height=300,width=700');
var doc=win.document.open('text/html','replace');
doc.writeln('<html>');
doc.writeln('<head>');
doc.writeln('<script>');
doc.writeln('alert(\'This is a line\');');
doc.writeln('</script>');
doc.writeln('<body>');
doc.writeln('Hai! How are you doing?');
doc.writeln('</body>');
doc.writeln('</html>');
</script></head></html>

Nov 10 '05 #1
2 1134
sy************@yahoo.com wrote:
Hi,

Is there any one who could help me to execute the following code
correctly.

<html>
<head>
<title>Some Title</title>
<script>
The type attribute is required:

<script type="text/javascript">

win=window.open('',null,'height=300,width=700');
var doc=win.document.open('text/html','replace');
document.open() does not take any parameters, but isn't needed anyway as
it is called automatically when document.write() is called.

<URL:http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-72161170>

doc.writeln('<html>');
doc.writeln('<head>');
doc.writeln('<script>');
The type attribute is required - you should write valid HTML always.

doc.writeln('alert(\'This is a line\');');
doc.writeln('</script>');
When included as a string in a write statement, the script endtag must
be treated with care - escape the slash:

doc.writeln('<\/script>');
doc.writeln('<body>');
doc.writeln('Hai! How are you doing?');
doc.writeln('</body>');
doc.writeln('</html>');
All those document.writes() are very expensive. Create the window and
do a single write - either build up the HTML as a single text string and
write that or concatenate the text.

And don't forget to close the document at the end:
win = window.open('',null,'height=300,width=700');
var newHTML = '<html><head><script type="text/javascript">'
+ 'alert("This is a line");'
+ '<\/script></head>'
+ '<body>Hai! How are you doing?</body>'
+ '</html>';
win.document.write(newHTML);
win.document.close();
or:

win = window.open('',null,'height=300,width=700');
win.document.write(
'<html><head><script type="text/javascript">',
'alert("This is a line");<\/script></head>',
'<body>Hai! How are you doing?</body></html>'
);
win.document.close();

</script></head></html>

--
Rob
Nov 10 '05 #2
Hi RobG,

I appreciate your immediate help.
Code given by you is working fine, and thanks, for tips to improve the
code.

Nov 10 '05 #3

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

Similar topics

1
by: Numberwhun | last post by:
Hello everyone! I am trying to learn java and have run into kind of a snag. Here is the code that I have so far: ------ <begin_code> ---------- import javax.swing.*; import...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
17
by: Amy | last post by:
Hi, I finished this script and for some reason there is a delay every so often in the timing. Sometimes it seems two take 2 seconds instead of 1. Can anyone see anything that would slow it down? I...
3
by: =?ISO-8859-1?B?Rvpsdmlv?= | last post by:
Hello all, My application delay some minutes when I press a button(it's doing some working ). How can I put a message: "Please wating" during this delay? It is important that after the...
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: 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
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.