View Full Version : open links in new window
ascskate
08-30-2006, 08:54 PM
anybody kno the script i can use to make a link that is clicked open up in a new window. i also want to be able to chose the size of the pop up window.
thx in advnace.
ascskate
blackpepper
08-30-2006, 09:07 PM
try something like this
<head>
<script type="text/javascript">
function popup() {
window.open('http://YOURPAGE.php,'popup','width=#,height=#');
}
</script>
</head>
<body>
<a href="javascript: popup()">Open Window</a>
</body>
ascskate
08-30-2006, 09:33 PM
thx for the help
ascskate
08-31-2006, 07:59 AM
wat would i need to do to that code to make it work if im using a picture as a link??
john-formby
08-31-2006, 08:04 AM
Hi,
You would need to change:
<a href="javascript: popup()">Open Window</a>
To:
<a href="javascript: popup()"><img src="IMAGE FILE" alt=""></a>
John
ascskate
08-31-2006, 08:17 AM
thanks so much. ill put it in my site as soon as i get home from school. ahh here comes my teacher. thx again
ascskate
RysChwith
08-31-2006, 08:39 AM
I'd recommend a slight variation to make it a little more accessible:<a href = "nameofpopuppage.htm" target = "_blank" onclick = "popup(); return false"><img src = "..." /></a>That way a user without JavaScript can still access the content.
Rys
ascskate
08-31-2006, 08:42 AM
yah thanks. the other way didnt work when i tried it and it will be better cuz as u said a user w/o javascript would be able to use it.
ascskate
08-31-2006, 08:44 AM
i tried it on picture and it worked perfectly thanks. ill do the rest when i have time
thanks so much.
ascskate
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.