我向在<head></head>中用javascript动态增加一行<link ...>
如题
谢谢
------解决方案--------------------var head=document.getElementsByTagName( "HEAD " );
var new_link = document.createElement( 'link ' );
new_link.type = 'text/css ';
new_link.href = 'css/style.css ';
head[0].appendChild( new_link );
------解决方案--------------------var head=document.getElementsByTagName( "HEAD " );
var new_link = document.createElement( 'link ' );
new_link.type = 'text/css ';
new_link.href = 'css/style.css ';
new_link.rel= "stylesheet "; //还要加上这句才行
head[0].appendChild( new_link );