RSS Forums RSS
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1509 | Replies: 7
Reply
Join Date: Jul 2006
Posts: 14
Reputation: sujagr8 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sujagr8 sujagr8 is offline Offline
Newbie Poster

Help Please rectify my error

  #1  
Jul 31st, 2006
how to include javascript in new window using window.open code
Thanks & Regards
Sujagr8
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation: Lafinboy is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 7
Lafinboy's Avatar
Lafinboy Lafinboy is offline Offline
Junior Poster

Re: Please rectify my error

  #2  
Jul 31st, 2006
Care to give a bit more information?
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.

Lafinboy Productions
:: Website Design :: Website Development ::

Reply With Quote  
Join Date: Dec 2004
Posts: 1,592
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Please rectify my error

  #3  
Jul 31st, 2006
The same way you include scripts in any other page. The window.open() method requires a URL as an argument. That URL will, of course, reference a page. That page will have whatever content the page author places in it, including scripts.

If you are asking about techniques for accessing parent-child DOM elements, you need to be more specific in your question.
Reply With Quote  
Join Date: Jul 2006
Posts: 14
Reputation: sujagr8 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sujagr8 sujagr8 is offline Offline
Newbie Poster

Re: Please rectify my error

  #4  
Aug 1st, 2006
hi
I used this code to open new window

newwindow2=window.open(' ','popup','scrollbars=1,height=800,width=800');

In that window itself i need script.
Is this scripting is correct or not

document.write('<'+'script type="text/javascript"' + 'src="jsr_class.js"><'+ '/script>');

Please reply soon
Last edited by tgreer : Aug 1st, 2006 at 12:12 pm.
Thanks & Regards
Sujagr8
Reply With Quote  
Join Date: Dec 2004
Posts: 1,592
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Please rectify my error

  #5  
Aug 1st, 2006
It depends on the DOCTYPE you're using. The "document.write()" method is deprecated in XHTML.

You'd also need a space before "src".
Reply With Quote  
Join Date: Jul 2006
Posts: 14
Reputation: sujagr8 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sujagr8 sujagr8 is offline Offline
Newbie Poster

Re: Please rectify my error

  #6  
Aug 2nd, 2006
hi
how to call a function inside script in document.write.
For example.
document.write('<'+'script type="text/javascript"' + 'src="jsr.js"><'+ '/script>');

In this jsr.js file i need to call one function how can i call using document.write method
Last edited by tgreer : Aug 2nd, 2006 at 11:24 am.
Thanks & Regards
Sujagr8
Reply With Quote  
Join Date: Dec 2004
Posts: 1,592
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Please rectify my error

  #7  
Aug 2nd, 2006
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 corresponding document.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 your window.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.
Reply With Quote  
Join Date: Jul 2006
Posts: 14
Reputation: sujagr8 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sujagr8 sujagr8 is offline Offline
Newbie Poster

Re: Please rectify my error

  #8  
Aug 3rd, 2006
Originally Posted by tgreer
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 corresponding document.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 your window.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 result.
Thanks & Regards
Sujagr8
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:45 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC