Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-02-2003, 05:59 PM   PM User | #1
loonatik
New Coder

 
Join Date: Mar 2003
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
loonatik is an unknown quantity at this point
document.write to current window

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.
loonatik is offline   Reply With Quote
Old 04-02-2003, 07:35 PM   PM User | #2
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
You can't use document.write() after the document has fully loaded. innerHTML is a viable solution.
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:39 AM.


Advertisement
Log in to turn off these ads.