Solved

getting errors on this line

Posted on 2004-09-20
6
224 Views
Last Modified: 2006-11-17
hi experts.
got a problem using this line. For some reason my browser appears with an  error. The popup opens fine, but it always opens with an extra window telling me there are errors. Seems this error does NOT appear using Internet Explorer.


<?php echo "<a href=javascript: onclick=\"javascript:window.open('mypage.php?id=". $ID."', 'test', 'fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=200,left=250,top=300')\">". $user." </a><br />";?>
0
Comment
Question by:kephillips
6 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 12107247
Just a slip of mind, but couldn't it be that the error is generated in the mypage.php and not during the generation of this line?

-r-
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 12107306
Firefox by any chance? i see the same thing

It could be because of the "javascript:" in the href, try removing it

<?php echo "<a href=\"\" onclick=\"javascript:window.open('mypage.php?id=". $ID."', 'test', 'fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=200,left=250,top=300')\">". $user." </a><br />";?>
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 12107319
Actually better still use JavaScript:void

<?php echo "<a href=\"javascript:void\" onclick=\"javascript:window.open('mypage.php?id=hk', 'test', 'fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=200,left=250,top=300')\">yjh </a><br />";?>
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 1

Expert Comment

by:pikachusalad
ID: 12107498
This isn't gonna look pretty, but it works...for me.

<?php echo "<a href=\"mypage.php?id=".$ID."\" target=\"_blah\" onclick=\"return window.open('mypage.php?id=". $ID."', '_blah', 'fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=200,left=250,top=300')\">". $user." </a><br />";?>

I know it looks like it's just using target="_blah" to make a new window, but if the target urls AND target windows in both are the same...you actually get the window you specify in the window.open...

Tested on Netscape, firefox, and IE...on WinXP
0
 
LVL 3

Expert Comment

by:Logan
ID: 12107871
Hi all,

::kephillips::

Why not to use an external JS function and call it each time you need it?

Try this:

<script language="javascript">
<!--
function myWindow( id ){
      var w = open('mypage.php?id=' + id, 'test', 'fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=200,left=250,top=300');
}
//-->
</script>

<?php
      echo "<a href=\"#\" onclick=\"myWindow( '".$ID."' )\">".$user." </a><br />";
?>

Hope that helps :)
Logan
0
 
LVL 20

Accepted Solution

by:
Muhammad Wasif earned 125 total points
ID: 12110799
Try this one, use # in href

<?php echo "<a href='#' onclick=\"javascript:window.open('mypage.php?id=". $ID."', 'test', 'fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=200,left=250,top=300')\">". $user." </a><br />";?>
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question