PDA

View Full Version : help with popups!



DJAg
May 27th, 2002, 19:00
Im new with HTML and I dont seem to find out how to do this.:confused2
I want two popups in the same page. They both gotta open when u click a link. It worked when it was only one but dont know how to do it with two :( Anyone can tell me or give me a good HTML help site?


This is the script I was using when it was only one popup:

<script language="javascript">
//<!--
function popup()
{ window.open ("popup.htm","popup","width=400,height=500,location=0,menubar=0,resizable=0,scroll bars=0,status=0,titlebar=1,toolbar=0") }
-->
</script>


What do I have to add or change to make it work??? :(

Dusty
May 27th, 2002, 20:00
You just want two popups like the one you've got now?


<script language="javascript"><!--
function popup(){
window.open("popup1.htm","popup1","width=400,height=500,location=0,menubar=0,resizable=0,scroll bars=0,status=0,titlebar=1,toolbar=0");
window.open("popup2.htm","popup2","width=400,height=500,location=0,menubar=0,resizable=0,scroll bars=0,status=0,titlebar=1,toolbar=0");
}
//--></script>

DJAg
May 27th, 2002, 20:16
they are two different pop ups but open in the same page.
tried the code you posted but pop ups wont open :(

Dusty
May 27th, 2002, 20:22
I just tested it, it does open two identical popups.

What do you mean by they "open in the same page"?

DJAg
May 27th, 2002, 20:33
ok its a news page and in two of the news it says 'if you want more info click here' then it should open a pop up, but a different pop up in each info not the same one.
maybe what is wrong is this:

NEWS1- <a href="javascript:popup1()">click here</a>
NEWS2- <a href="javascript:popup2()">click here</a>

should it be this way? using the code u posted.




****that was meant to be "javascript: popup1()" but without the space sorry turned out a smily*****

Dusty
May 27th, 2002, 20:47
Oh, I understand now. You've kind of already answer yourself as to how to do it, though:
<script language="javascript"><!--
function popup1(){
window.open("popup1.htm","popup1","width=400,height=500,location=0,menubar=0,resizable=0,scroll bars=0,status=0,titlebar=1,toolbar=0");
}
function popup2(){
window.open("popup2.htm","popup2","width=400,height=500,location=0,menubar=0,resizable=0,scroll bars=0,status=0,titlebar=1,toolbar=0");
}
//--></script>

NEWS1- <a href="#" onClick="popup1();return false;">click here</a>
NEWS2- <a href="#" onClick="popup2();return false;">click here</a>

That would be the simplest way. If your news pages are numbered, you could make it easier like this:
<script language="javascript"><!--
function popup(number){
window.open("popup"+number+".htm","popup"+number,"width=400,height=500,location=0,menubar=0,resizable=0,scroll bars=0,status=0,titlebar=1,toolbar=0");
}
//--></script>

NEWS1- <a href="#" onClick="popup('1');return false;">click here</a>
NEWS2- <a href="#" onClick="popup('2');return false;">click here</a>

DJAg
May 27th, 2002, 20:59
Its working perfect now! Thanks so much Dusty!!!! ;) :D