Omid Posted July 23, 2006 Share Posted July 23, 2006 Hi folks, I have been working on a new script and i have met the same problem a couple of times and i've decided to ignore them until now ;D. I have a php script and in the echo part, i have a link. I'm trying to get the link to open in a new window by using javascript but it doesnt work. [code]echo "<li><a href='javascript:newwindow()'>Edit</a></li>";[/code] and i have [code]<SCRIPT language="JavaScript">function newwindow(){window.open('inc/menu.php?cmd=edit&id=$id','jav','width=300,height=200,resizable=no');}</SCRIPT>[/code] in the <head> section. Any help would be appreciated. Thanks ;D Quote Link to comment https://forums.phpfreaks.com/topic/15373-opening-new-window/ Share on other sites More sharing options...
Branden Wagner Posted July 23, 2006 Share Posted July 23, 2006 have you tried:echo "<li><a href='javascript:newwindow();' onclick="newwindow();">Edit</a></li>"; Quote Link to comment https://forums.phpfreaks.com/topic/15373-opening-new-window/#findComment-62297 Share on other sites More sharing options...
Omid Posted July 23, 2006 Author Share Posted July 23, 2006 uhm... no i hadn't but i did now and still not working :S thanks anyways tho Quote Link to comment https://forums.phpfreaks.com/topic/15373-opening-new-window/#findComment-62298 Share on other sites More sharing options...
Branden Wagner Posted July 23, 2006 Share Posted July 23, 2006 correct way:window.open('url to open','window name','attribute1,attribute2')try changing the 'window name' to "new" instead of javedit: also try _new Quote Link to comment https://forums.phpfreaks.com/topic/15373-opening-new-window/#findComment-62300 Share on other sites More sharing options...
Omid Posted July 23, 2006 Author Share Posted July 23, 2006 YUP ;D;D thats it.... thanks Quote Link to comment https://forums.phpfreaks.com/topic/15373-opening-new-window/#findComment-62305 Share on other sites More sharing options...
Branden Wagner Posted July 23, 2006 Share Posted July 23, 2006 For future references the window name can only be one ofnew, blank... a few others by default.unless you have set the window namewindow.name="jav";if you want to call it jav. Quote Link to comment https://forums.phpfreaks.com/topic/15373-opening-new-window/#findComment-62306 Share on other sites More sharing options...
Omid Posted July 23, 2006 Author Share Posted July 23, 2006 wooow... it did have something to do with php... it was in a echo"" ... lol... ;D Quote Link to comment https://forums.phpfreaks.com/topic/15373-opening-new-window/#findComment-62310 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.