Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a New Window

Status
Not open for further replies.

hiyatran

Technical User
Aug 7, 2010
21
CA
when a user click on a link, it would open a new window in HTML it is something like this:
<a href=" target="_blank">click here</a>

How do I do this in Javascript? So a user would click on the link and it would open a new window. Here's my code
document.writeln('<tr><td>' + " + '</td></tr>');

I know window.open(url) would open a new window, but how do I make it clickable??

Any comments or suggestion would be greatly appreciated.
thanks


 
Keep it as a link, and even give it an onclick event if required.

Code:
document.writeln('<tr><td><a href="' + "[URL unfurl="true"]http://google.com"[/URL] + '">Click Here</a></td></tr>');

Or

Code:
var linkvar='<tr><td><a href="#"[red] onclick="window.open(\'[URL unfurl="true"]http://google.com\');"[/URL][/red]>[URL unfurl="true"]http://google.com</a>Click[/URL] Here</a></td></tr>'
document.writeln(linkvar);




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top