?
Solved

getting errors on this line

Posted on 2004-09-20
6
Medium Priority
?
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.
Suggested Courses

762 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