I don't know how to be more clear. Have you read and understood the answers you've already been given?
1. The
document.write()
method is out-of-date. However, if you're using an older DOCTYPE, it should still work for you.2. That being the case, you can author an entire page using
document.write()
, so you can place HTML, scripts, event handlers, whatever you like, on that page, just as you would any other page.3. The code you show uses a plus sign to concatenate strings, for some reason. It isn't necessary, but as you've shown it, there would be no space between "javascript" and "src=". You need to add a space before "src".
4. The
document.write()
method doesn't "call" anything. It writes a page. That page will need to have the code necessary to call a function... which is the same for any page.5. If you plan on using
document.write()
, you'll need a correspondingdocument.close()
.My questions to you would be:
1. Why are you using
document.write()
? If you know enough to write the code into your new window, chances are you know enough to simply author that page offline, and refer to it by URL in yourwindow.open()
call.2. Could you include the javascript in your main page, and have it act on your child window through DOM methods?
Also, please refrain from coloring or formatting your posts. We like to reserve formatting for code only.
Thanks a lot for your response.I got the …