方法一: jquery 中: $(function() { //do something }) //括号内写你的内容 方法二: html 中: html <body onload=''> <script type="text/javascript"