• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

document.write doesn't work in netscape

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
doesn't work in netscape why

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does work in Netscape?
Seriously, the document.write function will only "work" if it is executed during the inital phase of page display. So if your function is called from "in-line" script that executes as the page is rendering, it should work.
If your function is called after the page has been loaded, it will have no effect on the displayed page whatsoever.
hth,
bear
 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i call it in a form with an onclick. i stick onCLick in a button
i press the button in ie i get the output i press the button in netscape i get nothing
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add document.close(); after the write
 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Charlie that worked.... but
I didn't want to go into this but now I have a new problem.
The reason why I am doing is to clear the screen. The users will have two choices say do this or do that..... Each calls a seperate servlet. While the request is going to the servlet and then being processed I want to clear the screen so they don't start pressing buttons. When I use document.write() then document.close() the request does not come back to the window. What is coming back to the window is a jsp page with info on it.
Is there any other way I can do what I am trying to do?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you have created a race condition that could have unpredictable results. On one hand you are trying to write to the document and on the other you are submitting a servlet that is sending a response (I'm assuming that the resulting JSP is the result of forwarding by your servlets).
One suggestion (if I understand what you are trying to do correctly) might be to have your buttons not directly submit to the servlets, but rather to your "blank" page with enough information so that it can submit to the servlet of choice.
In this way you have a clear, serial path: your form submits to the blank page, which submits to the servlet, which replaces the blank page when done.
hth,
bear
 
Charlie Sturman
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If for instance you are submitting a form,then
build the html document in a string then write it.
document.write(string);
document.close();
now when the string/html is rendered and the on load event from body will trigger the submit form
and you have a blank page with a single submit.
I am not running the code but just putting something down so you get the idea.This is the
form of the submit function
 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't forget in NS4 you can always do a document.write() on a layer / div
 
Charlie Sturman
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually I have made it a point to forget about Netscape 4.x
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well ain't you the lucky one. Some of us don't have that luxury.
At least I'm not supporting NS3
 
reply
    Bookmark Topic Watch Topic
  • New Topic