Solved

opening a javascript link in php

Posted on 2006-11-09
6
229 Views
Last Modified: 2012-05-05
This is what I have so far the syntax is wrong and I can't seem to get it. I want  it to open 400px by 300px.


$strOut .= ' <a id="newsExtra'.$row['ID'].'" class="extra news" href="javascript:window.open("news/readnews.php?ID='.$row['ID'].'")" title="Read the full article with complete formatting" target="_blank"">Full Article</a>'."\n";
0
Comment
Question by:roscoeh23
[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
  • 4
6 Comments
 
LVL 15

Expert Comment

by:babuno5
ID: 17905963
try this out
$strOut .= ' <a id="newsExtra'.$row['ID'].'" class="extra news" href="javascript:window.open(\'news/readnews.php?ID="'.$row['ID'].'"\')" title="Read the full article with complete formatting" target="_blank"">Full Article</a>'."\n";
0
 
LVL 15

Expert Comment

by:babuno5
ID: 17905974
sorry missed a double quote
$strOut .= ' <a id="newsExtra'.$row['ID'].'" class="extra news" href="javascript:window.open(\'news/readnews.php?ID="'.$row['ID'].'"\')" title="Read the full article with complete formatting" target="_blank">Full Article</a>'."\n";
0
 

Author Comment

by:roscoeh23
ID: 17906046
It does not work it just opens this..

javascript:window.open('news/readnews.php?ID=

it just cuts off where the php value should be
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 15

Expert Comment

by:babuno5
ID: 17906077
$strOut .= ' <a id="newsExtra'.$row['ID'].'" class="extra news" href="javascript:window.open(\'news/readnews.php?ID='.$row['ID'].'\')" title="Read the full article with complete formatting" target="_blank">Full Article</a>'."\n";
0
 
LVL 15

Expert Comment

by:babuno5
ID: 17906137
Defining height and width of the window

$strOut .= ' <a id="newsExtra'.$row['ID'].'" class="extra news" href="javascript:window.open(\'news/readnews.php?ID='.$row['ID'].'\',\'mywindow\',\'width=400,height=300\')" title="Read the full article with complete formatting" target="_blank">Full Article</a>'."\n";
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 17906147
If you open a new window via javascript there is no need to give a target. Try:

$strOut .= ' <a id="newsExtra'.$row['ID'].'" class="extra news" href="#" onclick="window.open(\'news/readnews.php?ID='.$row['ID'].'\',\'\',\'width=400,height=300\'); return false" title="Read the full article with complete formatting">Full Article</a>'."\n";
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

687 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