• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

i to put hyperlink in javascript table

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i using the innerHTML to create the table like this::


i do i put in the hyperlink in the table value???
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
plz help me, i want to place the hyperlink in the innerHTML is it can???
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at document.createElement("a") and appendChil like I already mentioned. SEARCH GOOGLE.

Eric
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok thank you eric
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic