Use javaScript to dynamically load Js and Css files, and use javascriptcss
Loading CSS dynamically in JS is of great significance in the interface for changing themes. You can select your favorite page display mode based on your browsing habits. The following describes in detail.
I hope the following methods will help you.
(1) use JavaScript to dynamically load Js files
/* JavaScript dynamic loading of Js files */var scriptNode = document. createElement ('script'); scriptNode. src = 'proxy. js? T = '+ new Date (). getTime ();/* with the time parameter to prevent caching */document. head. appendChild (scriptNode );
(2) use JavaScript to dynamically load css files
/* JavaScript dynamic loading of Css files */var cssNode = document. createElement ('link'); cssNode. rel = 'stylesheet '; cssNode. type = 'text/css '; cssNode. media = 'screen'; cssNode. href = 'style.css? T = '+ new Date (). getTime ();/* with time parameters to prevent caching */document. head. appendChild (cssNode );
The above is how to use javaScript to dynamically load Js files and Css files. I hope it will be helpful for your learning.