Jump to content


Photo

Opening New Window


  • Please log in to reply
6 replies to this topic

#1 Omid

Omid
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 23 July 2006 - 04:19 AM

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.
echo "<li><a href='javascript:newwindow()'>Edit</a></li>";
and i have
<SCRIPT language="JavaScript">
function newwindow()
{
window.open('inc/menu.php?cmd=edit&id=$id','jav','width=300,height=200,resizable=no');
}
</SCRIPT>
in the <head> section. Any help would be appreciated. Thanks ;D

#2 Branden Wagner

Branden Wagner
  • Members
  • PipPipPip
  • Advanced Member
  • 111 posts

Posted 23 July 2006 - 04:25 AM

have you tried:

echo "<li><a href='javascript:newwindow();' onclick="newwindow();">Edit</a></li>";

#3 Omid

Omid
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 23 July 2006 - 04:28 AM

uhm... no i hadn't but i did now and still not working :S thanks anyways tho

#4 Branden Wagner

Branden Wagner
  • Members
  • PipPipPip
  • Advanced Member
  • 111 posts

Posted 23 July 2006 - 04:31 AM

correct way:
window.open('url to open','window name','attribute1,attribute2')

try changing the 'window name' to "new" instead of jav

edit: also try _new


#5 Omid

Omid
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 23 July 2006 - 04:37 AM

YUP ;D;D thats it.... thanks

#6 Branden Wagner

Branden Wagner
  • Members
  • PipPipPip
  • Advanced Member
  • 111 posts

Posted 23 July 2006 - 04:38 AM

For future references the window name can only be one of
new, blank... a few others by default.
unless you have set the window name

window.name="jav";

if you want to call it jav.

#7 Omid

Omid
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 23 July 2006 - 04:42 AM

wooow... it did have something to do with php... it was in a echo"" ... lol... ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users