1、<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title></title> <script type="text/javascript" src="js/jquery-1.7.2.js" ></script> </head> <body> <h5>hello world</h5> <script> alert("script脚本1") </script> <script> $(function(){ alert("页面加载完成") }) </script> <script> alert("script脚本2") </script> </body></html>

3、创建元素并追加到body中<script> $(function(){ $("<div><p>Hello</p></div>").appendTo("body"); }) </script>

5、//判断IEfunction isIE(){ var userAgent = navigator.userAgent, rMsie = /(msie\s|trident.*rv:)([\w.]+)/, rFirefox = /(firefox)\/([\w.]+)/, rOpera = /(opera).+version\/([\w.]+)/, rChrome = /(chrome)\/([\w.]+)/, rSafari = /version\/([\w.]+).*(safari)/; var browser; var version; var ua = userAgent.toLowerCase();

7、 var chVersion = { browser : match[1] || "", version : match[2] || "0" }; return false; } var match = rSafari.exec(ua); if (match != null) { var sfVersion = { browser : match[2] || "", version : match[1] || "0" }; return false; } if (match != null) { var ohterVersion = { browser : "", version : "0" }; return false; }}
