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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript create active link

Status
Not open for further replies.

peterpann

Programmer
Jun 19, 2007
63
GB
How can a javascript function produce links to another javascript function that will action when clicked ? link() writes the link but it is not active. Neither window.location = ""; as page refresh nor document.write() seem to help.

function function1()
{
var ss = "a";
var ii = 1;
var uu = "javascript:function2(" + ii + ")";
var vv = ss.link(uu);
ss = "b";
ii = 2;
uu = "javascript:function2(" + ii + ")";
vv += " " + ss.link(uu);
document.getElementById("myinput").value = vv; //writes text, not active links
}
 
Hi

peterpann said:
document.getElementById("myinput").value = vv;
If has [tt]value[/tt] property then it is either [tt]input[/tt], [tt]select[/tt], [tt]option[/tt] or [tt]textarea[/tt] - none of those can contain any HTML.
If has no [tt]value[/tt] property then can not do anything with it.

Use [tt]innerHTML[/tt] instead :

Feherke.
feherke.github.io
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top