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

Link within cell in JS created table

Status
Not open for further replies.

nath

Programmer
Dec 5, 2001
109
0
0
ES
Hello, complete newbie for javascript and web stuff in general. Here is my question.

I have a function that creates a table based on the values in a array. I use things like
Code:
...
newRow = document.getElementById("myTable").insertRow(1)
newCell = newRow.insertCell(newRow.cells.length)
newCell.innerHTML = db[i].ID
...

It all works fine. No problem so far.

But now I would like to make the content of that new cell (currently db.ID) a link. How can I do that?

ANy help appreciated!
 
Like this:
Code:
newCell.innerHTML = "<a href='[URL unfurl="true"]http://yahoo.com'>"[/URL] + db[i].ID + "</a>"

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Thanks Adam, exactly what I was looking for! Cheers mate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top