Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 20th, 2004, 04:21 PM
Friend of Wrox
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default Window.open from OnClick event in framed env.

I'll try and make this simple, I'm trying to load a page from an OnClick event that needs first to load an alert window. All in a framed-based environment.

While "window.location" works fine, it's biggest caveat is that is loads the requested URL into the "mainframe" area when I'd like to open in a new browser window.

When using window.open, it doesn't work at all??

Here's the snippets of the code involved:

The code with the link:

<A HREF="#" target="_blank" onclick="confirm_prompta('bodycopy bodycopy bodycopy'); return false;">TheLink</A>

The javascript function:

<script language="JavaScript" type="text/JavaScript">
function confirm_prompta(text) {
    if (confirm(text)) {
      window.location = ('http://www.theOtherSite.com')


Any help would greatly be appreciated,

Old December 21st, 2004, 04:01 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Can you show the code with window.open that fails?

Alternatively just use:
<A HREF="http://www.theOtherSite.com" target="_blank" onclick="return confirm('bodycopy bodycopy bodycopy');">TheLink</A>
if you just want a plain new window.


Joe (Microsoft MVP - XML)
Old December 22nd, 2004, 10:06 AM
Authorized User
Join Date: Sep 2004
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nashnash

--try this----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
    function openMyWindow()
        var oChk=window.confirm("Do you want to Open new window?")

            return false;

    <a href="#" onclick="openMyWindow()">open window</a>


Plz let me know if it doesnt solve your purpose..send me the code so that i can fix...


Old December 22nd, 2004, 11:30 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Nash,
Thanks for your reply, but this problem has been resolved.

Thanks to all for your help!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer value from framed popup to framed mainpag wester Javascript How-To 1 December 27th, 2004 03:56 PM
Clsing Parent Framed Window swykpisz Javascript How-To 1 October 28th, 2004 04:46 PM
Open framed html and target frame fs22 Javascript How-To 2 May 5th, 2004 04:25 PM
onclick event pigtail Javascript 1 April 11th, 2004 03:10 PM
onClick Event mateenmohd Javascript 4 December 16th, 2003 01:08 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.