Solved

opening a javascript link in php

Posted on 2006-11-09
6
223 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

19 Experts available now in Live!

Get 1:1 Help Now