View Full Version : Some popup problems!

10-19-2003, 11:23 PM
I've made a "members" page, where you can se info about different people. I've made it that way, when you click on a name an info box pops up with detailed infos.

The problem is that they all link to the same link, though i have typed different url's and stuff.
The source are available http://tsn.dk/p/?id=2466here (http://tsn.dk/p/?id=2466)

Sorry if my english is bad, i aint good at it.
And by the way, im a js-newbie...

/ SnooZeR

10-19-2003, 11:33 PM
<script language="javascript">
function openpopup(popurl)
<a href="#" onclick="openpopup('infzheik.htm');">Open Me1</a>
<a href="#" onclick="openpopup('infcbus.htm');">Open Me2</a>
<a href="#" onclick="openpopup('infsnz.htm');">Open Me3</a>

The whole purpose of a function is so you don't have to right the code over and over. Pass that which is changing through the function.

Hope That Helps,

10-20-2003, 02:17 PM
though i still have one question, what shall i write instead of the "#" in this line: <a href="#" onclick="openpopup('infsnz.htm');">Open Me3</a>

10-20-2003, 02:45 PM
Hi SnooZeR ,

You don't have to change it. That just tells the browser to void the link so that when you click on it it won't try to load something into the window rather it will just do the onClick. If you don't want to use the onClick you could also perform the function this way when you click on the link:

<a href="javascript:openpopup('infzheik.htm');">Click Me1</a>

10-20-2003, 03:17 PM
My site still keep telling me there is an error, so i have decided to upload det whole sourcecode with the JS-code Basscyst told me...

You guys can see it here: http://tsn.dk/p/?id=2468

10-20-2003, 09:16 PM
winpops=window.open(popurl,""," width=500,height=500,toolbar,location,directories,
Put this all into one line. That should solve the problem.

Remember some people have javascript disabled on their browser, and the window may not open for them (not sure, haven't tested it yet). Change the # to the destination url, and add return false to the end of the onclicks. The page will open in the same window for those who disabled javascript.

<a href="infzheik.htm" onclick="openpopup('infzheik.htm');return false">Open Me1</a>
<a href="infcbus.htm" onclick="openpopup('infcbus.htm');return false">Open Me2</a>
<a href="infsnz.htm" onclick="openpopup('infsnz.htm');return false">Open Me3</a>