Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File:New:Window

Status
Not open for further replies.

VergeResources

Programmer
Feb 6, 2002
40
US
Is there a way to simulate the File:New:Window menu option using javascript? I want to duplicate my current window and then force it to submit.
 
This code should do the job... When I save this code, run it, and click the link, it creates an exact copy of itself:

Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
	function dupWindow() { var winHandle = window.open(top.location, '', ''); }
//-->
</SCRIPT>
</HEAD>
<BODY>
Click <A HREF=&quot;javascript:dupWindow();&quot;>here</A> to duplicate this window...
</BODY>
</HTML>

Hope this helps!

Dan
 
how about

var copy = window.open(location.href);
copy.document.forms[0].submit();



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
The problem with using location.href is that it will only give you a copy of the current document, which is not always the whole window (if you are in a frameset, for example).

If you are in a frameset, you want the whole thing, so you'd use top.location. If you only wanted the current document, then document.location (or location.href) would be fine.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top