ghurty Posted October 20, 2009 Share Posted October 20, 2009 Can someone please explain to me what I am doing wrong here?: I have this script which I have in the html file <script language="JavaScript"> function newWindow(mypage,myname,w,h,features) { if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; }else{winl = 0;wint =0;} if (winl < 0) winl = 0; if (wint < 0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; win = window.open(mypage,myname,settings); win.window.focus(); } </script> And then I have this link: <a href="java script:newWindow('../sendemail.php?'+document.location.href,'email',400,350,'')">Tell a Friend</a> But when ever I click on the link, instead of a popup window, I it tries to load a page and I get the following error: Access Forbidden: http://localhost/java%20script:newWindow%28%27../sendmail.php?%27+document.location.href,%27email%27,400,350,%27%27%29 Thanks Link to comment https://forums.phpfreaks.com/topic/178311-instead-of-poping-up-link-try-to-open-a-bad-page-why/ Share on other sites More sharing options...
ghurty Posted November 2, 2009 Author Share Posted November 2, 2009 Can anyone help please? Thanks Link to comment https://forums.phpfreaks.com/topic/178311-instead-of-poping-up-link-try-to-open-a-bad-page-why/#findComment-949753 Share on other sites More sharing options...
BillyBoB Posted November 3, 2009 Share Posted November 3, 2009 I haven't read much else but I'm pretty sure its 'javascript:' not 'java script:' <a href="javascript:newWindow('../sendemail.php?'+document.location.href,'email',400,350,'')">Tell a Friend</a> Not: <a href="javascript:newWindow('../sendemail.php?'+document.location.href,'email',400,350,'')">Tell a Friend</a> Link to comment https://forums.phpfreaks.com/topic/178311-instead-of-poping-up-link-try-to-open-a-bad-page-why/#findComment-949895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.