View Full Version : HTML in JavaScript

Luis Ribeiro
10-17-2003, 05:55 PM
I have a menu created in JS and i want one of the links to open in a new Browser window.
How can i do this? Is it possible to insert an HTML tag (<a href...>) in JS ?

10-17-2003, 07:01 PM
Have you tried adding target="_blank" to your <a href> link tags?

This should cause the link to be loaded in a new browser window.

10-17-2003, 07:09 PM
It's easier to help you if you can show us some code...

But usually you can insert the <a> tag using innerHTML, as:

containerElement.innerHTML = '<a href="...">Link</a>';

Or use the DOM:

var aTag = document.createElement("A");
var text = document.createTextNode("Link");

Luis Ribeiro
10-20-2003, 10:47 AM
The menu i'm using is the HV Menu available in Dynamic Drive.