老师授课-2-点击之后变化
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>无标题文档</title> 6 7 </head> 8 9 <body> 10 <br /> 11 <div id="me"><b>试试吧</b></div><br /> 12 13 <input type="button" value="请点击" onclick="change()" /> 14 </body> 15 </html> 16 <script> 17 function change() 18 { 19 var a =document.getElementById("me"); 20 a.innerHTML="<font color='red'>Hello world!</font>"; 21 } 22 </script>
运行
点击之前
点击之后