Jump to content

myWindow.document.write will not write to new window


rob38dd

Recommended Posts

I am running Windows 8 Pro with Internet Explorer 10. When I try to run the script in: http://www.w3schools.com/jsref/met_win_blur.asp the new about:blank window opens but the text in: myWindow.document.write("<p>This is 'myWindow'</p>"); will not write to the new about:blank window. If I change the script to read: this.document.write("<p>This is 'myWindow'</p>"); the text will write to the current window. The same script works in the newest version of FoxPro and worked in my old IE8 browser. Can anyone tell why myWindow.document.write will not work in Internet Explorer 10 or what I could do to get it to work? Thanks, Rob ~ rernster@rapidnet.com

Link to comment
Share on other sites

You shouldn't really be opening new windows, that stopped being good practice years ago. Instead, do something like have a model pop up in the current window (something similar to a lightbox, but with text). You also shouldn't use document.write, as it can cause a number of problems and behaves different depending on what stage of loading the page is at. You should use document.createElement or jQuery to create the element, popular it, and then add it to the page. It's a lot easier with jQuery, so I'd recommend using it here.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...