473,378 Members | 1,500 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,378 software developers and data experts.

Windows and Javascript - Clear contents.

Hi,

Please Help!

I have developed a custom JSP tag that produces Javascript to create a
window and write HTML and Javascript to that window. This window
displays an error message.

The problem is this. When the page with the custom tag is refreshed
without closing the (error) window the content written to the window
in the first place is written again. Thus, the error message appears
twice. The window source will then basically contain a replica of the
code, appended to the end of the first section of code. What I want
to do is clear the contents of the window before writing the HTML and
Javascript to that window. I have found a method document.clear()
which does not seem to be supported by IE. Does anyone know how I
achieve the same functinality?! Alternatively, I want to be able to
close the window and create a new window (with an error message) but I
don't know how I can check if the window is open. Remember that all
the functionality must be contained within the Javascript output by
the tag (the HTML page where the tag resides cannot be modified).

Any help would be much appreciated. Thanks,

Rob.
Jul 20 '05 #1
2 17729
ro***************@accenture.com (Rob Videtta) writes:
The problem is this. When the page with the custom tag is refreshed
without closing the (error) window the content written to the window
in the first place is written again. Thus, the error message appears
twice.
Remember to close the document after writing to it (and open it before).
I.e., the code to write to the error window is

errorWindowRef.document.open();
errorWindowRef.document.write(errorContent);
errorWindowRef.document.close();
The window source will then basically contain a replica of the
code, appended to the end of the first section of code. What I want
to do is clear the contents of the window before writing the HTML and
Javascript to that window. I have found a method document.clear()
which does not seem to be supported by IE. Does anyone know how I
achieve the same functinality?!
Closing and reopening the document should be sufficient.
Alternatively, I want to be able to close the window and create a
new window (with an error message) but I don't know how I can check
if the window is open.


!(errorWindowRef.closed)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Hi,

Lasse Reichstein Nielsen wrote:
ro***************@accenture.com (Rob Videtta) writes:

The problem is this. When the page with the custom tag is refreshed
without closing the (error) window the content written to the window
in the first place is written again. Thus, the error message appears
twice.

Remember to close the document after writing to it (and open it before).
I.e., the code to write to the error window is

errorWindowRef.document.open();
errorWindowRef.document.write(errorContent);
errorWindowRef.document.close();


Just to be clear, document.write also opens the document if it was not
already open. As such, the call to document.open() before
document.write() is not necessary.

<snip>

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #3

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

Similar topics

3
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
7
by: multicherry | last post by:
Hi, Having searched for a way to fetch a window object by name, all I came across were answers along the line of... "All you have to do is say windowObj = window.open("blah", "name");" which...
9
by: oz | last post by:
Hi All, I want to make a dictionary with windows application. My data is html format. therefore, i use webBrowser control on my windows form. If the user click any word in webBrowser control,...
9
by: Jess | last post by:
Hello, I tried to clear a vector "v" using "v.clear()". If "v" contains those objects that are non-built-in (e.g. string), then "clear()" can indeed remove all contents. However, if "v"...
9
by: mevryck | last post by:
Greetings I have a huge Javascript with inclusion of external scripts and all. I got this by doing a XSLT . Now I have the contents in a Javascript variable, but I'm not able to update the...
2
by: toronto | last post by:
Seasons Greetings Everyone! I want to use JavaScript's event object to detect whether someone has pressed the 'PrintScreen' key to screenshot, via the Windows Clipboard, and to print website...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
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: 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.