> HTML comments inside script tags are unnecessary and potentially harmful.
Correct me if I'm wrong, but isnt this recommended or is it just old
practise where it was common for browsers to not recognise the <script>
tag?
By 'actual string value' I guess you want the source. The simple answer
is you can't, and more importantly you should not use innerHTML to
modify a table, use document object model (DOM) methods.
Ok, if I have a table with a sepcific ID, is it possible to alter the
rows (<tr><td></td></tr>)? How would this be done using DOM? Ideally if
you could provide a short example, it would be much appreciated.
Ultimately what I am trying to achieve is to dynamically ceate a table
on the 'client-side' with values taken from an XML file. Below is an
example of this file:
<?xml version="1.0" encoding="iso-8859-1"?>
<friends>
<person>
<firstname>Martin</firstname>
<surname>Bishop</surname>
<age>24</age>
</person>
<person>
<firstname>Robert</firstname>
<surname>Kennedy</surname>
<age>18</age>
</person>
<person>
<firstname>Nigel</firstname>
<surname>MacInnes</surname>
<age>23</age>
</person>
</friends>
The reason I would like to create this using JavaScript is because I
would like to be able to manipulate the table (ie. sort by column
header) without having to reload the page, where I would normally use
server-side scripting. The whole idea is to reduce page reloads. Is my
above method not capable of doing this? If so, if there a better way I
should be doing this? Ideally, I would like to use XML as it stores
values very neatly for this type of operation but if this isnt possible
I would be willing to explore other alternatives.
Cheers
Burnsy