/    Sign up×
Community /Pin to ProfileBookmark

Opening one window at a time?

Greetings

I have a page that has a link to open a separate window and display some dynamic text data. I am using the following script to open that window and it works fine. I feel i should mention that this script is placed in the HTML file of the page page with the link.

{if(command==”openWindow”){ openNewWindow()}}
function openNewWindow(){setTimeout(
window.open(‘expertise.html’,’newwindow’,
‘height=200,width=300,toolbar=no’)),0}

I also would like to have another link on the same page which opens another separate window, however if I reuse the above script in the same HTML document, when I click the links it open two windows simultaneously. This is the script I am using for the second window

{if(command==”openWindow”){ openNewWindow2()}}
function openNewWindow2(){setTimeout(
window.open(‘gallery.html’,’newwindow2′,
‘height=200,width=300,toolbar=no’)),0}

Is there any way to keep it from opening both windows at once?
I’m sure there’s an easy solution, however, scripting is not my strong point

Thank You

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@david_dieselauthorMar 30.2005 — anyone? please?
Copy linkTweet thisAlerts:
@Warren86Mar 30.2005 — Is this what you are trying to do?

<HTML>

<Head>

<Script Language=JavaScript>

var lastPop = "";

function popWin(curr){

if (lastPop != ""){lastPop.window.close()}
lastPop = window.open(curr,"nWin","toolbar=0,menubar=0,statusbar=0,width=250,height=200")
}

</Script>

</Head>

<Body>

<a href=# onclick="popWin('something.html')"> Open Window 1 </a><br>

<a href=# onclick="popWin('somethingElse.html')"> Open Window 2 </a>

</Body>

</HTML>
Copy linkTweet thisAlerts:
@david_dieselauthorMar 30.2005 — Warren

I'm using this script as part of a Flash movie. Within Flash's actionscript I used the FSCommand(openWindow). I've included the script you saw in my original post in the html document. I may try what you gave me soon. Just looking for a way to make the browser differentiate between when to use the first part of the script and when to use the second part.
Copy linkTweet thisAlerts:
@Warren86Mar 30.2005 — You know, I understand your attempt to be brief, but it oftentimes isn't in your best interest or the best interest of those who may respond. To omit the fact that you are working with Flash, may cause others, initially, like me, to waste our time.

Your example code had basic popup windows, opening an html document. Suddenly, that changed, and now Flash is involved.

Please, in the future, if you seek help here, clearly, completely and concisely state the ENTIRE problem, and/or your ULTIMATE goal.

Avoid piecemealing your problem. It isn't in your best interest, or the best interest of those who volunteer their time to respond to you.

And, in case you didn't learn common courtesy as a child, a simple expression of gratitude, individually to ALL who have posted more than a cursory response, IS in your best interest.
×

Success!

Help @david_diesel spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...