1.有如下代码,请说出程序的运行结果
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script type="text/javascript"> var a=0;//第一步:a=0; setTimeout( function(){ alert(++a);//第三步:a=21; a=100; },100 ); a=20;//第二步:a=20; </script> </body> </html>
弹出21
2.略
3.有如下代码,请说出两块div的尺寸和Hello word的颜色。
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> #cotent{width: 400px;} div{width: 100%;} .box>div{width: 200px;} .block{width:300px;} .red{color: red;} .blue{color:blue;} </style> </head> <body> <div class="box"> <div id="cotent" class="blue block red"> hello </div> </div> </body> </html>
box宽100%
cotent宽400px
Hello word为蓝色
具体原因为:http://www.cnblogs.com/flyings/p/5401410.html
4.实现轮播图,分别用js和css3
js实现
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="js/jquery-2.1.4.min.js" ></script> <style type="text/css"> #box{width: 400px; position:relative; overflow: hidden; background-color: red; height: 200px; } #picShow{width: 1200px; height: 200px; background-color: #fff; position: absolute; } #picShow img{width:400px; float:left; } </style> </head> <body> <div id="box"> <div id="picShow"> <img alt="" src="images/1.jpg" /> <img alt="" src="images/2.jpg" /> <img alt="" src="images/3.jpg" /> </div> </div> <script type="text/javascript"> function move(){ $("#picShow").animate({marginLeft:-400},"slow",function() { $("#picShow img:last").after($("#picShow img:first")) $("#picShow").css({marginLeft:0}) }) } setInterval(move,2000) </script> </body> </html>
css3实现
暂无
时间: 2024-10-18 01:34:03