D
Deryck
Hi,
I am trying to update part of a webpage using javascript. The bit that gets
updated will have a variable number of links written to it.
I have done this successfully by rewriting the whole page but this seems
like overkill (and a maintenance problem too potentially).
I thought about defining the area to be updated using a div. Something like
this:
<div id="results">Results will go here</div>
with the javascript doing something like:
var src = "blah blah blah";
document.getElementById('results').childNodes[0].nodeValue = src;
This works if src is just text. If it is HTML, say:
var src="<p><a href=\"some_file.html\">Some file</a></p>";
Then inside the div instead of getting a link to some_file.html I get the
raw HTML.
Is there either a way round this problem or a much better way of doing it in
the first place?
Thanks
Deryck
I am trying to update part of a webpage using javascript. The bit that gets
updated will have a variable number of links written to it.
I have done this successfully by rewriting the whole page but this seems
like overkill (and a maintenance problem too potentially).
I thought about defining the area to be updated using a div. Something like
this:
<div id="results">Results will go here</div>
with the javascript doing something like:
var src = "blah blah blah";
document.getElementById('results').childNodes[0].nodeValue = src;
This works if src is just text. If it is HTML, say:
var src="<p><a href=\"some_file.html\">Some file</a></p>";
Then inside the div instead of getting a link to some_file.html I get the
raw HTML.
Is there either a way round this problem or a much better way of doing it in
the first place?
Thanks
Deryck