Solved

getting errors on this line

Posted on 2004-09-20
6
225 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Suggested Solutions

Title # Comments Views Activity
PHP: Best way to scan folders and process files 10 59
Wordpress Query 5 42
Change static entered data to dynamic with counter 5 32
deprecated mysql extensions 1 22
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…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

679 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