Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes HTML, CSS and JavaScript and the fly likes Add a Table Row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Add a Table Row" Watch "Add a Table Row" New topic
Author

Add a Table Row

cara dastoli
Greenhorn

Joined: May 22, 2007
Posts: 13
Hi,

I need some help making an Table Row a Link.
The following code works just fine, however, I don't know how to make the text a link. Can anyone show me an example on how to do this? Please link to any site. Thanks in advance!

Cara

<script language="JavaScript"><!-- Begin
function addRow(id){
var tbody = document.getElementById
(id).getElementsByTagName("TBODY")[0];
var row = document.createElement("TR");
var td1 = document.createElement("TD");
td1.appendChild(document.createTextNode("Please make this a link."));
row.appendChild(td1);
tbody.appendChild(row);

}
// End -->
</script>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61191
    
  66

The same way that you would if you were marking this up in HTML: create an <a> element in which to put the text of the link.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
cara dastoli
Greenhorn

Joined: May 22, 2007
Posts: 13
Originally posted by Bear Bibeault:
The same way that you would if you were marking this up in HTML: create an <a> element in which to put the text of the link.

Is it <A> or <A HREF>? Neither one seems to work for me.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61191
    
  66

A is the tag name. HREF is one of its attributes.

Neither one seems to work for me.


That is not a useful explanation of your issue.
[ July 17, 2007: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Add a Table Row