lazyRascal
Programmer
I'm trying to dynamically change an anchor and image within a <div> section from a function.
example:
function changeInfo{
var text1, text2, text3
text1 = "<a nohref>"
text2 = "<img src='dog.gif'>"
text3 = "</a>"
document.getElementById('myDiv').innerHTML = text1 + text2 + text3
}
This code works with unwanted consequences. It displays NaN before displaying the image. Just to check, I tried this code sending text1 only, with text1 = 75. The 75 displayed without the NaN. So, I'm assuming the browser (Foxfire) is expecting a number, although I don't know why.
I'm trying to get the simpliest form of this I can come up with to work. Then, I want to add an onMouseOver event to the anchor.
I don't really understand concatination well, so I'm struggling with this. Part of the problem is that I'm using VBscript in my asp to generate this javascript function.
My objective is to produce the following:
<a nohref onmouseover="document.getElementById('sq1').src='over.gif'; document.getElementById('pic').src='/images/cat.jpg'";
onmouseout="document.getElementById('sq1').src='off.gif'; document.getElementById('pic').src='images/dog.jpg'";
onClick="myRef = window.open('show.asp?picture=dogCloseup.jpg','mywin',
'left=420,top=220,width=274,height=260,toolbar=0,resizable=0'); myRef.focus()">
<img src="off.gif" id="sq1" border="0"></a>
I hope this posting is stated clearly enough to figure out what I'm asking.
Thanks in advance. Any help is greatly appreciated.
Thanks