Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DHTML script wont work how I want (compatible w/ IE4+ only)

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Why does it make the image only once, the first time you click, not every time? Please email responses to pete_c12@hotmail.com Thanks

<BASE HREF=&quot;<html>
<head>

<script>
var image1 = &quot;car.gif&quot;;

function move()
{
var xpos = window.event.clientX;
var ypos = window.event.clientY;
document.write('<div style=&quot;position:relative; left:' + xpos + '; top:' + ypos + '&quot;><img src=' + image1 + '></div>')
alert(&quot;&quot; + xpos + &quot; , &quot; + ypos + &quot;&quot;)
}

</script>

</HEAD>
<BODY onclick=move()>

</body>

</html>
 
hi
>>pete:
never use document.write() when your page finished loading!!!
use
<span id=mmm style=&quot;position:absolute&quot;></span>

var obj=document.all.mmm
- ie <5.0
or
var obj=document.getElementById(&quot;mmm&quot;)
- ie5+ or nn6
obj.innerHTML='new content'

or
with (document.layers.mmm.document){
open()
write('new content')
close()
}
for nn4x

regards, vic


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top