Solved

getting errors on this line

Posted on 2004-09-20
6
227 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
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…

737 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