Friday, May 15, 2009

How to create dynamic hyperlink in javascript

How to create dynamic hyperlink in javascript


To create a dynamic hyperlink using javascript, this blog will be very useful.
here 'filelist' is a string array with the collection of urls.
just pass this string arrayto this loop to create dynamic hyperlinks in a very simple way.
here is the code using javascript.

for(var i=0;i<=filelist.length-1;i++)
{
var link = document.createElement("A");
link.href = filelist[i];
var atext = document.createTextNode(myArray[i].split('.'));
link.appendChild(atext);
link.style.backgroundColor = "#B7C3D3";
link.setAttribute('target','_blank');
divId.appendChild(link);
var lnk = document.createElement("A");
var lnktext=document.createTextNode(" ");
lnk.appendChild(lnktext);
divId.appendChild(lnk);
//divId.appendChild(" ");
}

to create dynamic hyperlink using c# click the link below

http://kannanmk.blogspot.com/2009/05/create-dynamic-hyperlink-using-c-to.html

No comments:

Post a Comment

HTML/JAVASCRIPT BLOG

You can find the help for html and javascript codes

Any Doubts Contact my Mail-ID:
kannan.mkv@gmail.com