This code has two buttons: one that moves the vent from (100,100) to (200,200), and another that writes 100,000 random numbers between -10,000 and 10,000 on the vent.
Shortcut: ventanas
<button onclick="nova()">nova</button>
<button onclick="movizq()">izq</button>
<button onclick="movder()">der</button>
<button onclick="movale()">ale</button>
<button onclick="stopale()">STOP</button>
<script type="text/javascript">
var vent
var posX=screen.availWidth/2-100
var posY=screen.availHeight/2-100
var rtof=false//random true o false
var nrx//numero random x
var nry//numero random y
var intervalrandom
function nova() {
vent=window.open("","","height=200,width=200")
vent.moveTo(posX,posY)
}
function movizq() {
vent.moveBy(-10,0)
}
function movder() {
vent.moveBy(10,0)
}
function movale(){
intervalrandom = setInterval(activarmovale,100)
function activarmovale(){
nrx=Math.random()*1000+100
nry=Math.random()*1000+100
vent.moveTo(nrx,nry)
}
}
function stopale() {
clearInterval(intervalrandom)
}
</script>