直接上代码 //检测页面是否引用了laydate.js if($("script[src='/static/core/laydate/laydate.js']").length <= 0){//未引用则引用 var body = $("body"); var script = $("<script>"); $(script).attr('type','text/javascript'); $(script).attr('src','/static/core/laydate/laydate.js'); $(body).append(script); }