Page is a not externally linkable
Fotiman - 2:39 pm on Oct 11, 2007 (gmt 0)
Note, I haven't tested any of this, and I'm not sure what context you're running it in (a web page?). Hope it helps though.
Sounds like you'd want something like this:
function replaceNodeWithAttrValue(newValue, refNode) {
var parent = refNode.parentNode;
parent.replaceChild(document.createTextNode(newValue), refNode);
}
It would help if you added id attributes to your nodes. For example:
<img alt="wigget" src="http://example.com/wigget/red-wigget.jpg" width="100" height="120" class="class1" id="redwigget">
<form id="formX">
<input type="hidden" name="amount" value="19.99">
</form>
Then you could do:
window.onload = function() {
var img = document.getElementById('redwigget');
replaceNodeWithAttrValue(img.src,img);
var frm = document.getElementById('formX');
replaceNodeWithAttrValue(frm['amount'].value, frm);
};