...

View Full Version : document.write to current window



loonatik
04-02-2003, 06:59 PM
i have this on my page:

<head>
<script language="javascript">
function viewNews(article) {
view=window.open("","view","fullscreen=0")
view.document.write("<html><head></head><body>")
view.document.write(article)
view.document.write("</body></html>")
view.window.resizeTo(400,300)
}
</script>
</head>

<body>
<a href="javascript:viewNews('my name is loonatik')">click here</a>
</body>

What this does is open a new window and writes 'my name is loonatik' to that new window.

But what I want is for the text to be written in the current window (no pop-up). Do I have to use innerHTML? I was looking for the effect of a viewnews.php. I'm using this to display articles so I wouldn't have to create separate pages for my 70+ articles. I've tried changing window.open to window.location and pointing it to a template, but it doesn't work. Any solutions?
Thanks.

beetle
04-02-2003, 08:35 PM
You can't use document.write() after the document has fully loaded. innerHTML is a viable solution.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum