my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes i to put hyperlink in javascript table 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 "i to put hyperlink in javascript table" Watch "i to put hyperlink in javascript table" New topic
Author

i to put hyperlink in javascript table

albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
i using the innerHTML to create the table like this::


i do i put in the hyperlink in the table value???


JAVA the only can called technology
albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
i try to use the document.write but this will make my pages cannot display out just the value of the document.write can be display out
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Hvae you tried to write out a link syntax to a string and stick it in the innerHTML? You can also look into document.createElement("a") with appendChild();

Eric
Linda Walters
Ranch Hand

Joined: Apr 30, 2005
Posts: 100
Whenever you are dealing with the dynamic creation of tables in HTML or with dynamically modifying the data within them, you need to be aware of some quirks (some would say bugs) in the way that Microsoft Internet Explorer handles tables.

The most important of these quirks is that IE does not allow you to modify the contents of a <td> tag. So, if you have a table data tag with an id of, say, row1col1 and you tried to do the following:



it will not work in IE. It works fine in any of the Mozilla family of browsers. To get around this quirk, you need to create your table so that any data that you might ever want to change dynamically is in some other container, such as a <div>, which in turn is inside the <td>.

So, if we have:



We can then to the following in JavaScript:



This will work for all browsers (except maybe Opera).

Also, outputing the table with the JavaScript method "document.write(s)" is fine if you are building the complete document dynamically, but if you are trying to add to or modify an existing document, that is one that is currently being viewed on the browser by the user, "document.write(s)" will overwrite the existing document or portions of it.

If you are adding the table to an existing document, then have a <div> on the document so that you can add the table by adding to the division's innerHTML.


<a href="http://labryssystems.net/pblog/index.php" target="_blank" rel="nofollow">Javaville Gazette</a><br />Non-cooperation with evil is a duty. -- Mahatma Gandhi
albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
i use the javascript function to create a table is just because i'm using AJAX to make request from the server, and from the server script i pass back the value using 'out.println' and i want the value keep display out using table, and the value been pass in to the table will have hyperlink to another page. i donno how to put in the hyperlink to the insRow function to make the parameter value pass in have the hyperlink.

can provide the solution to me ???
albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
plz help me, i want to place the hyperlink in the innerHTML is it can???
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Look at document.createElement("a") and appendChil like I already mentioned. SEARCH GOOGLE.

Eric
albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
ok thank you eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i to put hyperlink in javascript table