...

View Full Version : Some popup problems!



SnooZeR
10-19-2003, 10: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

Basscyst
10-19-2003, 10:33 PM
Code:
<html>
<head>
<script language="javascript">
function openpopup(popurl)
{
winpops=window.open(popurl,"","width=500,height=500,toolbar,location,directories,status,menubar,")
}
</script>
</head>
<body>
<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>
</body>
</html>

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,
Basscyst

SnooZeR
10-20-2003, 01:17 PM
thanks...
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>

requestcode
10-20-2003, 01: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>

SnooZeR
10-20-2003, 02: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

wickford
10-20-2003, 08:16 PM
winpops=window.open(popurl,""," width=500,height=500,toolbar,location,directories,
status,menubar,")
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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum