Click to See Complete Forum and Search --> : Javascript Popup


guus
03-13-2003, 11:51 AM
y0 fellawZ,

i'm having a problem.....it's like this.
how do i can get several links. And they al lead to a popup.
like there are 5 links in my page and if u click on them they will load a smaller new window with a htm. page in it. Now i did in but all the links refer to the same popup. But i got several pop ups made. :| how can i solve this problem >>???

sincerely v2Ldesign

gil davis
03-13-2003, 12:04 PM
You have to give the pop-up a name, and use the same name every time you open the pop-up. Something like:window.open(URL, "myPopup", features);

guus
03-13-2003, 01:14 PM
back again :P,
the problem is i don't know anything of javascript. So i got this script from uhhmm. sum javascript site. And i don't know what i have to change to make the pop-ups that i want to popup :P

i have this text,
more info
and the command attached to it
javascript:openpopup()

and then the script.
function openpopup(){
var popurl="movie1.htm"
winpops=window.open(popurl,"","width=400,height=350,toolbar,scrollbars,location,status,resizable")
}

gil davis
03-13-2003, 01:21 PM
function openpopup(){
var popurl="movie1.htm"
winpops=window.open(popurl,""," width=400,height=350,toolbar,scrollbars,location,status,resizable")
}Change to:function openpopup() {
var popurl = "movie1.htm";
winpops = window.open(popurl, "myPopup", "width=400,height=350,toolbar,scrollbars,location,status,resizable");
}

guus
03-13-2003, 01:27 PM
hi guys,
sozz for the language :)
but uhhmm it doesn't work.

like can i just edit the script and change the site link the whole time, or do i have to edit the link that refers to the script also ? maybe u can give me an example. How u guys put 2 links to 2 different popups in the same page ?

sincerely guus

gil davis
03-13-2003, 01:42 PM
You will have to be more specific.

Do you need to control the window after it is open?

guus
03-13-2003, 02:13 PM
sorry message didn't get through.

control ? i just want when u click the link, it will open a popup with the page, or image in it, but i want to know how to do this, with 2 links that both refer to a different popup.

pyro
03-13-2003, 02:27 PM
How about this:

<script language="javascript" type="text/javascript">

function popup(url,winname)
{
winpops = window.open(url, winname, "width=400,height=350,toolbar,scrollbars,location,status,resizable"); //add to line above
}
</script>
</head>
<body>
<a href="winone.htm" onClick="popup(this.href,'winone'); return false;">window one</a>
<br/>
<a href="wintwo.htm" onClick="popup(this.href,'wintwo'); return false;">window two</a>

guus
03-13-2003, 02:34 PM
omFG,
i don't get it !!!!!!!!
hahaha....so frustrating !
can somebody make an example of sum sort ?
or explain to me, how do u make, 1 link if clicked popup with a page or image in it, and another link i clicked popup but with an other page or image load in it. WAAH ! :|

pyro
03-13-2003, 02:38 PM
You need to explain your self better. Do you want one popup window, with multiple pages loading into it, or, multiple popup windows?

guus
03-13-2003, 02:38 PM
JavaScript Popup window generator

Use this JavaScript wizard to instantly create, customize, and add Pop Up windows to your site! For the uninitiated, a popup refers to a secondary, usually smaller window that loads on top of the main window, and contains a separate HTML document inside of it. To create your own popup, just follow the three simple steps below, and grab the generated code. It's that simple!

Step 1: Configure the look of the popup window (Be sure to click the "Live Preview" link to instantly see how the window looks):

Tool Bar: .Location Bar: Directory Bar: .Status Bar:
Scrollbars: .Menu Bar: Resizable? .Live preview!

Step 2: Do you want the popup window to load automatically, or via
a text link?
. Automatically Text link
Step 3: Should the window pop up only ONCE per browser session* (applicable only if window is launched automatically)?



Simply copy the generated code into the <BODY> section of your webpage, and you're done!

<script>

//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts

function openpopup(){
var popurl="thankyou.htm"
winpops=window.open(popurl,"","width=400,height=338,location,directories,status,")
}

</script>

<a href="javascript:openpopup()">Click here to open window</a>


----------------------------------------------------------------------

Configuring the popup further:

-To change the document contained inside the popup, change the variable "popurl" of function openpopup()
-To alter the width/height of the popup window, change the width and height attributes inside function openpopup()
-To learn more about customizing popup windows, refer to this tutorial.
----------------------------------------------------------------------

so uhhmmm whut i want, is 2 or more of those text-links to a pop-up with both different contents !

pyro
03-13-2003, 02:42 PM
If the code that I posted above is not what you need, it must be this...

<html>
<head>
<script language="javascript" type="text/javascript">

function popup(url,winname)
{
winpops = window.open(url, winname, " width=400,height=350,toolbar,scrollbars,location,status,resizable"); //add to line above
}
</script>
</head>
<body>
<a href="winone.htm" onClick="popup(this.href,'winone'); return false;">window one</a>
<br/>
<a href="wintwo.htm" onClick="popup(this.href,'winone'); return false;">window two</a>
</body>
</html>

guus
03-13-2003, 03:09 PM
okay it's like this 'very simple'

first i want a link

MORE INFO

then i want that link to
load a popupwindow with the html file mystuff.htm

it must be loaded with a
size, 300 to 500,scrollbar and window status

----------------------------------------------------------------------
then i want another link

MORE HASSLE

then i want that link to
load a popupwindow with the html file myHassle.htm

it must be loaded with a
size, 100 to 500,scrollbar and window status

----------------------------------------------------------------------
and maybe in the future more of these links to a popupwindow. that's the idea !

guus
03-13-2003, 03:37 PM
<script language="">

function openpopup2(){
var popurl="exilim.htm"
winpops=window.open(popurl,"","width=400,height=338,status,scrollbars,")
}

</script>
<a href="javascript:openpopup2()">Click here to open window</a>

<script language="">

function openpopup1(){
var popurl="macromedia.htm"
winpops=window.open(popurl,"","width=400,height=338,status,scrollbars,")
}

</script>
<a href="javascript:openpopup1()">Click here to open window</a>
----------------------------------------------------------------------
I GOT HIM !!!!!!!!!!
hehe tnx anyway !

sincerely n00b@javascript though a genius :P

pyro
03-13-2003, 03:37 PM
You still have not explained what we actually need to know. ;)

Say you click MORE INFO. That will popup a new window. Now, say you click MORE HASSLE before you close the popup window that is open. Do you want the MORE HASSLE page to overwrite the current popup window, or open a new popup window?

pyro
03-13-2003, 03:44 PM
What you posted should do nothing different from my second code snippet.... :confused:

rmurphy
03-15-2003, 02:06 AM
I think the problem here is a lack of understanding what the code is doing. Maybe this will help.

The javascript command: winpops=window.open(popurl,"","width=400,height=338,status,scrollbars,")

1) "window.open" is a function that opens a new window, and assigned it to the variable winpops. This is not a popup window, but another window with all the functionality of the calling window.

2) The first parameter (ie. popurl) of the window.open function is the name of the url to load into the window.

3) The second parameter of the window.open function is a name assigned to the popup. This is important, if this parameter is left blank, a new popup window is created. If this parameter contains a name, and a window with the same name is already created, it's reused.

4) The third parameter is window options like… can the user resize the window, or the width and height of the window.


so… if you need to create windows with different sizes and names, you can create two different functions, or simply pass the height, width and window name to the function.


<html>
<head>
<script language="javascript" type="text/javascript">

function popup(name,height,width,url)
{
var options="toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height;

var myPopup = window.open(url, name, options);
}
</script>

</head>
<body>
<a href="moreinfo.htm" onClick="popup('popup1','300','500','mystuff.htm'); return false;">MORE INFO</a>
<br/>
<a href="morehassle..htm" onClick="popup('popup2','100','500','myHassle.htm'); return false;">MORE HASSLE </a>
</body>
</html>

I Hope this helps...

guus
03-15-2003, 03:17 AM
y0 fellawz,
stop replying hahaha :P
i already solved the problem a, read my previous messages,
i have changed the names lik this


----------------------------------------------------------------------

function openpopupab(){


function openpopupab(){
var popurl="http://www.mailscript.nl/form/index.php?nr=1046"
winpops=window.open(popurl,"Comments","width=520,height=400,status,scrollbars,")
}

----------------------------------------------------------------------
by just changing he name openpopupab(){
and function openpopupab(){
----------------------------------------------------------------------

tnx anyway :)

guus
03-18-2003, 07:30 AM
DAMN ! i can't get the popup to work WHAHAHAA>..

i want to make a pop-up !!!! grrrr
damN !

can somebody give me a pop-up script, that really works !!!???

pyro
03-18-2003, 07:34 AM
If you look back to my earlier posts, I have given you two different popup scripts that will work in different situations. One of them must be what you are looking for... :rolleyes:

guus
03-18-2003, 07:37 AM
OMFG, hehe
i tried all of them, but they don't work ?
maybe becuz i use dreamweaver ?
do i have to set the text link on blank_, or just none ?
cause when i dont do that, it will give a large page :|
or is it just my computer ???

pyro
03-18-2003, 07:40 AM
Either post a link, or attach the exact code that you are using...

guus
03-18-2003, 07:42 AM
<html>
<head>
<script language="javascript" type="text/javascript">

function popup(name,height,width,url)
{
var options=" toolbar=no,location=no,directories=no,status=yes,m
enubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height;

var myPopup = window.open(url, name, options);
}
</script>

</head>
<body>
<a href="moreinfo.htm" onClick="popup('popup1','300','500','mystuff.htm'); return false;">MORE INFO</a>
<br/>
<a href="morehassle..htm" onClick="popup('popup2','100','500','myHassle.htm'); return false;">MORE HASSLE </a>
</body>
</html>



this one, ill put it in my site.....wait

guus
03-18-2003, 07:45 AM
this is the link

http://members.home.nl/ter.beek/preview.htm

pyro
03-18-2003, 08:05 AM
You did not follow the code that I had posted, but you can try this code...

guus
03-18-2003, 08:17 AM
mmm....i changed the script but when i open it, it stall opens in large windows :|

pyro
03-18-2003, 08:27 AM
I may have uploaded the wrong file. Try this:

guus
03-18-2003, 08:30 AM
oploaded it, but it still doesn't work ! :S

cyberade
03-18-2003, 08:44 AM
Sorry to butt in but just a thought, I couldn't see where window.open was being called.

In the line


var myPopup = winwindow.open(url, name, winoptions);


I took out the 'var myPopup =win' bit and it seemed to work.

guus
03-18-2003, 08:47 AM
so where do i need to put the new code ?

pyro
03-18-2003, 09:55 AM
Yes, that is what the problem was. There is not command winwindow.open. The correct command is window.open.

guus
03-18-2003, 10:03 AM
EUH, so whuts the code again, im to confused to get it :|
and to n00b :D

cyberade
03-18-2003, 10:08 AM
Look for the line


var myPopup = winwindow.open(url, name, winoptions);


and change it to


window.open(url, name, winoptions);

pyro
03-18-2003, 10:14 AM
Or, if you are going to be needing to add content to the window later, etc. do it like this:

var myPopup = window.open(url, name, winoptions);

guus
03-18-2003, 10:29 AM
i mean the whole code :D

tnx tnx

pyro
03-18-2003, 10:38 AM
If you want the whole code, the second file that I uploaded is working fine for me....

guus
03-18-2003, 10:46 AM
http://members.home.nl/ter.beek/preview2.htm


check this one
to see it in actoin

pyro
03-18-2003, 10:52 AM
Works for me in IE6