判断页面是否有jquery

1  if(document.readyState!="complete"){alert("请等待页面加载完毕...");}
2 else{
3 if(typeof jQuery=="undefined"){
4 script=document.createElement("script");
5 script.setAttribute("charset","utf-8");
6 script.src="http://www.durenyuan.com/jquery.js";
7 document.head.appendChild(script);
8 }
9 } 

 终极版本

if(typeof jQuery == 'function'){
    jy_start();
}else{
    var script=document.createElement("script");
    script.type = 'text/javascript';               
  script.src="http://www.919yi.com/static/frontend/js/jquery-1.9.1.min.js"; document.getElementsByTagName('head')[0].appendChild(script); var hander=window.setInterval(function(){ if(typeof jQuery=='function'){ window.clearInterval(hander); jy_start(); } },3000); }

 

posted @ 2014-10-10 17:22  kim_berley  阅读(560)  评论(0编辑  收藏  举报