问题描述
php文件里写的JavaScript语句是不是可以直接剪切到外部js中然后调用啊例如php里的<SCRIPTlanguage=javascripttype=text/javascript>varMiniSite=newObject();MiniSite.Browser={ie:/msie/.test(window.navigator.userAgent.toLowerCase()),moz:/gecko/.test(window.navigator.userAgent.toLowerCase()),opera:/opera/.test(window.navigator.userAgent.toLowerCase()),safari:/safari/.test(window.navigator.userAgent.toLowerCase())};MiniSite.$=function(s){return(typeofs=='object')?s:document.getElementById(s);};MiniSite.JsLoader={load:function(sUrl,fCallback){var_script=document.createElement('script');_script.setAttribute('charset','gb2312');_script.setAttribute('type','text/javascript');_script.setAttribute('src',sUrl);document.getElementsByTagName('head')[0].appendChild(_script);if(MiniSite.Browser.ie){_script.onreadystatechange=function(){if(this.readyState=='loaded'||this.readyStaate=='complete'){fCallback();}};}elseif(MiniSite.Browser.moz){_script.onload=function(){fCallback();};}else{fCallback();}}};MiniSite.Cookie={set:function(name,value,expires,path,domain){if(typeofexpires=="undefined"){expires=newDate(newDate().getTime()+10*24*3600*1000);}document.cookie=name+"="+escape(value)+((expires)?";expires="+expires.toGMTString():"")+((path)?";path="+path:";path=/")+((domain)?";domain="+domain:"");},get:function(name){vararr=document.cookie.match(newRegExp("(^|)"+name+"=([^;]*)(;|$)"));if(arr!=null){returnunescape(arr[2]);}returnnull;},clear:function(name,path,domain){if(this.get(name)){document.cookie=name+"="+((path)?";path="+path:";path=/")+((domain)?";domain="+domain:"")+";expires=Fri,02-Jan-197000:00:00GMT";}}};functionloadJS(url,load){var_script=document.createElement('script');_script.setAttribute('type','text/javascript');_script.setAttribute('src',url);document.getElementsByTagName('head')[0].appendChild(_script);if(!load)return;if(document.all){_script.onreadystatechange=function(){if(this.readyState=='loaded'||this.readyState=='complete'){load();}};}else{_script.onload=function(){load();};}}</SCRIPT>可不可以把<SCRIPTlanguage=javascripttype=text/javascript></SCRIPT>去掉然后新建一个js文件把它粘贴在里面php里用<scripttype="text/javascript"src="xxxx.js"></script>调用啊
解决方案
解决方案二:
没人??第一次在这里发帖呢
解决方案三:
可以。
解决方案四:
en
解决方案五:
楼主聪明