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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Onlick 2 Pop Ups

Status
Not open for further replies.

dakoz

Programmer
Feb 2, 2002
74
i have downloaded several scripts...
and by clicking on a link only one pop up appears.

i want onclick to popUp 2 pages.

can anyone tell me how 2 do it?

i am new in javascript sorry if this is an easy question
 
Onlick? Wow - hve not heard about that technology - not a good idea during flu and cold season though... [afro2]

[conehead]
 
function pop2() {
first = window.open("win1.htm","one","toolbar=no,width=100,
height=100,left=0,top=0")
second = window.open("win2.htm","two","toolbar=no,width=130,
height=200,left=100,top=0")

}
this way you can open multiple window..

hope this helps you..
 
Ehh, more dynamically:

Code:
function popWin(url, h, w) {
    var w = window.open(url, 'win', 'height=' + h + ',width=' + w);
}

...

<a href="#" onclick="popWin('page1.html',300,200); popWin('page2.html',300,400); return false;">Open Two Windows</a>

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
I Tried the solution that cLFlaVA gave me but i want to pop up 2 windows.

in the code provided 2 urls open but inside the same window... i need to open 2 new windows.

i tried target="_blank" but this didnt work.


thanks

 
i think mrpro's first method ought to work...

Known is handfull, Unknown is worldfull
 
yes but the second method suits me best because i can configure instantly what window to open at each link. i can handle this easier with my code
 
Yeah, the first method shown should work fine but I can seen why clflava tried to make it a bit more re-usable. Just needs an array to hold the different popups ...

Code:
function popWin(url, h, w) {

	if ( !window.popups ) window.popups = new Array;
	popups[ popups.length ] = window.open(url, 'win' + popups.length, 'height=' + h + ',width=' + w);
}

HTH.
 
mmm this is working better
can i manage the toolbars also? Can i set parameters like toolbar=yes?
 
See here for how to make further specifications on the browser window.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top