posted 17 years ago
I have a <span id="aa"> to enclose a link tag with href="#" as the url. When a user clicks some button, I want to put some real href address to it. So I use:
var na = document.getElementById("nameField").value;
document.getElementById("aa").innerHTML = "<a href=\"blah.html?name=\""+na+"\" >Products</a>";
to replace previous value within the span.
But when I move mouse over the link, it will only show 'blah.html?name=', the value of name is missing. I got the variable na's value correctly by using document.getElementById()... Why can't the link show the value of na?
Someone please help, thanks.
SCJA, SCJP5.0, SCBCD, SCWCD