1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <!--引入框架--> 7 <link href="resource/bootstrap/css/bootstrap.css" rel="stylesheet"> 8 <script src="resource/jQuery/jquery-1.11.3.js"></script> 9 <script src="resource/bootstrap/js/bootstrap.js"></script> 10 11 <!--引入自己的js--> 12 <script src="js/demo1.js"></script> 13 14 <style> 15 /*css选择器:class,id,标签,复合选择器*/ 16 </style> 17 </head> 18 <body> 19 <script> 20 //每隔一秒钟学号和姓名互换 21 var i = 0; 22 window.onload=change; 23 setInterval('change()',1000); 24 function change() 25 { 26 if(i%2) 27 { 28 document.getElementById("result").innerHTML='姓名:张三'; 29 }else 30 { 31 document.getElementById("result").innerHTML='学号:0303003'; 32 } 33 i++; 34 } 35 </script> 36 <div id="result"></div> 37 38 39 </body> 40 </html>