/* 方法一 */
function addCssByLink(url) {
var link=document.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");
link.setAttribute("href", url);
var heads = document.getElementsByTagName("head");
if (heads.length)
heads[0].appendChild(link);
else
document.documentElement.appendChild(link);
}
function addJsByLink (url) {
var script=document.createElement("script");
script.setAttribute("type", "text/javascript");
var heads = document.getElementsByTagName("head");
script.setAttribute("src", url);
if(heads.length)
heads[0].appendChild(script);
else
document.documentElement.appendChild(script);
}
/* 方法二 */
document.write("<link rel=\"stylesheet\" href=\"./link.css\" type=\"text/css\" media=\"screen\"/>");
document.write("<script type=\"text/javascript\" src=\"script.js\"><\/script>");