Web Hosting Talk







View Full Version : New Custom Window Link Pop-Up???


RH4U
08-22-2004, 05:26 PM
Trying to have it so when people click on a link a small information pop-up pops up to the left corner of my site. I know how to have links open in new pages.

But how do you define what size and what position the new page loads in? Ive seen it many times on the web, but im assuming its javascript or something similar.

Anyone know what im talking about and how to do it?

Loon
08-22-2004, 05:40 PM
yes, javascript. You'll find loads of these around but this is the way i do it, because:

a) the link displays the true url of the window it's going to open (some people are a little uneasy about clicking links that just call a function or display the url as "#")

b) if the user has javascript disabled, it'll still open in a new window



<script type="text/javascript">
<!--
function popUp(PopURL,PopWidth,PopHeight)
{
PopValues = "resizable,height = "+PopHeight+",width = "+PopWidth;
window.open(PopURL, 'newWin', PopValues);
}
//-->
</script>


and to use in your page:



<a href="yourpage.htm" onclick="popUp(this.href,400,165);return false;" target="newWin">click me</a>


the values in the second part (400,165) are width and height, which obviously you can edit. =]

RH4U
08-22-2004, 05:56 PM
Great! Thanks alot, appreciate the answer..