欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用javaScript動(dòng)態(tài)加載Js文件和Css文件

 更新時(shí)間:2015年10月24日 15:51:39   投稿:lijiao  
這篇文章主要介紹了如何使用javaScript動(dòng)態(tài)加載Js文件和Css文件

JS動(dòng)態(tài)加載CSS 在可換主題的界面中具有很重要的意義,用戶可以根據(jù)自己的瀏覽習(xí)慣選擇自己喜歡的頁(yè)面顯示方式,下面詳細(xì)說(shuō)明。

希望下面的方法對(duì)你有幫助。
(1)使用JavaScript動(dòng)態(tài)加載Js文件

/*JavaScript動(dòng)態(tài)加載Js文件*/ 
var scriptNode = document.createElement('script'); 
scriptNode.src = 'proxy.js?t='+new Date().getTime();/*附帶時(shí)間參數(shù),防止緩存*/ 
document.head.appendChild(scriptNode); 

(2)使用JavaScript動(dòng)態(tài)加載css文件

/*JavaScript動(dòng)態(tài)加載Css文件*/ 
var cssNode = document.createElement('link'); 
cssNode.rel = 'stylesheet'; 
cssNode.type = 'text/css'; 
cssNode.media = 'screen'; 
cssNode.href = 'style.css?t='+new Date().getTime();/*附帶時(shí)間參數(shù),防止緩存*/ 
document.head.appendChild(cssNode); 

以上就是使用javaScript動(dòng)態(tài)加載Js文件和Css文件的方法,希望對(duì)大家的學(xué)習(xí)有所幫助。

相關(guān)文章

最新評(píng)論