Log in

View Full Version : Link to popup window - Javascript question


Aunt Clara
09-09-2006, 09:15 PM
I want to add a link to a calculator for converting cooking measures in the postbit. This page is in the root folder (forum is in /forums folder). I need to add this code in the header:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=275,height=750,left = 502.5,top = 137');");
}
// End -->
</script>

I did that in showtread, but it isn?t working. Where should I add it?

Thanks.

OK, so I got it working by following the instructions in this thread (https://vborg.vbsupport.ru/showthread.php?t=11285&highlight=javascript+popup+code+head):

<script language="JavaScript">
function popup(url, window_name, window_width, window_height)
{ settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=no,"+
"resizable=yes,width="+window_width+",height="+window_height;

NewWindow=window.open(url,window_name,settings); }
</script>

<a href="#"
onclick="popup('mynewpage.php', 'Window', 160, 200);">Newpage</a>

Now the problem is that the page is redirected to the homepage when I click on popup opens.