coderInSD
06-03-2006, 12:51 AM
i am having a problem when setting the innerHTML of a div with html that contains an img tag. the img tag contains a relative path in the src when i set the innerHTML but when i grab the value it has resolved it to the full url. this only happens in IE6.0 (well i've only tested that and firefox but i only need it to work in IE).
<script>
function Test()
{
var xElem = document.getElementById( "testing" ) ;
var sHTML = "<img src=\"/content/images/blank.jpg\" />" ;
alert( sHTML ) ;
xElem.innerHTML = sHTML ;
alert( xElem.innerHTML ) ;
}
</script>
<div id="testing"></div>
<input type="button" value="test" onclick="Test()">
what i want is for the paths to not resolve ie. stay the same as when i set it. instead i get <img src="http://localhost/content/images/blank.jpg"/>. i tried using the DOM methods (createTextNode, appendChild, etc) and i see the same results. i've searched and searched and can't find an answer...any help is greatly appreciated!
<script>
function Test()
{
var xElem = document.getElementById( "testing" ) ;
var sHTML = "<img src=\"/content/images/blank.jpg\" />" ;
alert( sHTML ) ;
xElem.innerHTML = sHTML ;
alert( xElem.innerHTML ) ;
}
</script>
<div id="testing"></div>
<input type="button" value="test" onclick="Test()">
what i want is for the paths to not resolve ie. stay the same as when i set it. instead i get <img src="http://localhost/content/images/blank.jpg"/>. i tried using the DOM methods (createTextNode, appendChild, etc) and i see the same results. i've searched and searched and can't find an answer...any help is greatly appreciated!