Solved

getting errors on this line

Posted on 2004-09-20
6
217 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:pikachusalad
Comment Utility
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:nenufarloganx
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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…
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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now