<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <script> var subwin= window.open("win.html","_blank","top=300,left=300,width=200,height=200"); function show(obj){ subwin.document.bgColor=obj.value; } function demo(){ window.document.title="####################"; } function closeit(){ if(!subwin.closed){ subwin.close(); } } </script> <input type="button" onclick="show(this)" value="red"><br> <input type="button" onclick="show(this)" value="green"><br> <input type="button" onclick="show(this)" value="yellow"><br> <input type="button" onclick="show(this)" value="blue"><br> <input type="button" onclick="show(this)" value="#ff00ff"><br> </body> </html> win.html <body> <script> opener.demo(); function show(obj){ opener.document.bgColor=obj.value; } </script> <input type="button" onclick="show(this)" value="red"><br> <input type="button" onclick="show(this)" value="green"><br> <input type="button" onclick="show(this)" value="yellow"><br> <input type="button" onclick="show(this)" value="blue"><br> <input type="button" onclick="show(this)" value="#ff00ff"><br> </body
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <script> window.open("win.html","_blank","top=300,left=300,width=200,height=200"); // var subwin= function show(obj){ window.document.bgColor=obj.value; } function demo(){ window.document.title="####################"; } function closeit(){ if(!subwin.closed){ subwin.close(); } } </script> <input type="button" onclick="show(this)" value="red"><br> <input type="button" onclick="show(this)" value="green"><br> <input type="button" onclick="show(this)" value="yellow"><br> <input type="button" onclick="show(this)" value="blue"><br> <input type="button" onclick="show(this)" value="#ff00ff"><br> <!--<div id="one" style="background: red;position: absolute;left: 0;top: 0;width: 100px;height: 100px;">i am ad!</div>--> <!--<script>--> <!--var x=0;--> <!--var y=0;--> <!--var xs=10;--> <!--var ys=10;--> <!--var one=document.getElementById("one");--> <!--function move(){--> <!--x+=xs;--> <!--y+=ys;--> <!--if(x>=document.body.clientWidth-one.offsetWidth-20||x<=0){--> <!--xs=-1*xs;--> <!--}--> <!--if(y>=document.body.clientHeight-one.offsetHeight-20||y<=0){--> <!--ys=-1*ys;--> <!--}--> <!--one.style.left=x;--> <!--one.style.top=y;--> <!--}--> <!--var dt=setInterval("move()",100);--> <!--one.onmouseover=function(){--> <!--clearInterval(dt);--> <!--}--> <!--one.onmouseout=function(){--> <!--dt=setInterval("move()",100);--> <!--}--> <!--</script>--> <!--<img style="position: absolute;left: -400px;top: -200px" src="img/bluecity.jpg">--> <!--<script>--> <!--var tu=document.getElementById("tu");--> <!--document.onmousemove=function(e){--> <!--var ev=e||window.event;--> <!--var x=ev.clientX;--> <!--var y=ev.clientY;--> <!--tu.style.top=y+20;--> <!--tu.style.left=x+20;--> <!--}--> <!--</script>--> <!--<div id="one"> </div>--> <!--<script>--> <!--var one=document.getElementById("one");--> <!--function test(){--> <!--alert(event);--> <!--var cx=event.clientX;--> <!--var cy=event.clientY;--> <!--var sx=event.screenX;--> <!--var sy=event.screenY;--> <!--var str="clientX="+cx+",clientY="+cy+",screenX="+sx+",screenY="+sy;--> <!--one.innerText=str;--> <!--window.status=str;--> <!--window.document.title=str;--> <!--}--> <!--</script>--> <!--<body onkeydown="show()">--> <!--<img src="img/haha.gif" border="0" id="ren">--> <!--<script>--> <!--//獲取圖片名--> <!--function basename(url){--> <!--var loc=url.lastIndexOf("/")+1;--> <!--return url.substr(loc);--> <!--}--> <!--//建立圖片都象--> <!--var ren=document.getElementById("ren");--> <!--function changetu(){--> <!--if(basename(ren.src).charAt(6)=="i")--> <!--{--> <!--ren.src="img/20141117165842.gif";--> <!--}else{--> <!--ren.src="img/20140912095041.gif";--> <!--}--> <!--}--> <!--// changetu();--> <!--setInterval(function(){--> <!--changetu();--> <!--},1000);--> <!--</script>--> <!--<div id="one" style="color: red; font-size: 250px; text-align: center">0</div>--> <!--<script>--> <!--var one=document.getElementById("one");--> <!--var i=1;--> <!--var dt=null;--> <!--// var dt=setInterval(function(){--> <!--// one.innerText=i;--> <!--// i++;--> <!--// },100);--> <!--function stop(){--> <!--clearInterval(dt);--> <!--}--> <!--function start(){--> <!--dt=setInterval(function(){--> <!--one.innerText=i;--> <!--i++;--> <!--},100)--> <!--}--> <!--start();--> <!--</script>--> <!--<input type="button" onclick="stop()" value="stop">--> <!--<input type="button" onclick="start()" value="start">--> </body> </html>