wrote on 07 apr 2006 in comp.lang.javascript
:
Hi
I am a beginner in javascript. I have a small problem.
I have the following html code :
Code:
<tr> <td> <div id = div> html1 </div> </td></tr>
<tr> <td> <div id = div2> html2 </div> </td></tr>
I would like to replace what's html1 by html2 and html2 by html1 every
x seconds. how can I do that?
The table elements are not important here.
Try this for once every 1000 miliseconds:
=======================================
<div id = div1> html1 </div>
<div id = div2> html2 </div>
<script type='text/javascript'>
var div1 = document.getElementById('div1')
var div2 = document.getElementById('div2')
function swapdDivs(){
var temp = div2.innerHTML
div2.innerHTML = div1.innerHTML
div1.innerHTML = temp
}
setInterval('swapdDivs()',1000)
</script>
========================================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)