[SOLVED] popup and document.write problem in IE

This is a discussion on "[SOLVED] popup and document.write problem in IE" within the JavaScript Forum section. This forum, and the thread "[SOLVED] popup and document.write problem in IE are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 26th, 2007, 14:33
New Member
Join Date: Sep 2007
Location: tokyo
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up [SOLVED] popup and document.write problem in IE

i would like to popup a window and document.write with javaScript.
The following works fine on FF, Safari, NS, both on Mac and PC, but fails in IE (6 and 7 as far as i know).
it opens a new window in IE, but it doesn't write anything. not even my title.
any suggestion?


parameters are

Pic = 'pic1.jpg'
wVal = 500
hVal = 500
Name= 'nw_one'
pTitle= 'picture 1'

(new window opens in 500 x500 with title showing my xml address)

(this is written in xsl, i don't think it matters. )

HTML: Select all
    <script language="JavaScript">
    <![CDATA[
    
    
    function image(Pic,wVal,hVal,pTitle,Name){
    
    subWin = window.open("",Name,"width="+ wVal + ",height=" + hVal +",top=0,left=0");
    subWin.document.open();
    subWin.document.write('<html><head><title>'+pTitle+'</title>');
    subWin.document.write('</head><body background="'+ Pic +'">');
    subWin.document.write('</body></html>');
    subWin.document.close();
    subWin.focus();

    
    }
    ]]>
    </script>


thanx or your help.

Last edited by deluxmilkman; Sep 26th, 2007 at 15:58. Reason: mistake

  #2 (permalink)  
Old Oct 3rd, 2007, 07:50
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: popup and document.write problem in IE

Hi Milkman, seems I missed this post last week.

I have just used the exact same code listed there and it works (title and all) in IE 6 & 7..

How are you calling the function?
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
  #3 (permalink)  
Old Oct 3rd, 2007, 11:21
New Member
Join Date: Sep 2007
Location: tokyo
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: popup and document.write problem in IE

yeah,it's working on mine now. it might have been some security problem.
thanks anyway.
  #4 (permalink)  
Old Oct 3rd, 2007, 11:26
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: popup and document.write problem in IE

Quote:
Originally Posted by deluxmilkman View Post
(this is written in xsl, i don't think it matters. )
Oh, I think it does!

document.write cannot be used on pages that the browser processes as XML (source).

You should use the DOM instead. This is a good idea anyway; once you get used to them, DOM methods are much more powerful than document.write.Of course, you can ignore this if no browsers are processing your page as XML. But it's still worth learning DOM methods.

Last edited by MikeHopley; Oct 3rd, 2007 at 11:35.
Closed Thread

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] document.getElementsByTagName djeyewater JavaScript Forum 2 Jan 22nd, 2008 22:04
[SOLVED] do you write quicker Hosting & Domains 8 Dec 12th, 2007 05:13
[SOLVED] How do I write IE conditional comment Lchad Web Page Design 23 Oct 17th, 2007 01:29
new problem. document.getElementById().width returning unassigned. why? sanchopansa JavaScript Forum 2 Jul 22nd, 2006 20:23
Need help with document.write command MojoP JavaScript Forum 0 Aug 15th, 2005 18:15


All times are GMT. The time now is 22:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43