问: 如题 用javascript调用服务器上的CSS文件 或者是动态地生成CSS 可行吗? 请各位帮忙了 ______________________________________________________________________________________________ 答1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD>
<BODY> <P ID=oPara STYLE="color:green;"> This is the test paragraph.</P>
<BUTTON onclick="alert(oPara.style.cssText);oPara.style.cssText='color:red';"> Get CSS attributes</BUTTON>
</BODY> </HTML>
______________________________________________________________________________________________ 答2: <link id=m rel=stylesheet href="docEdit.css" type="text/css"> <input onclick="document.all.m.href='http://lucky.myrice.com/cssforv6/index.css'" value="change" type=button> ______________________________________________________________________________________________ 答3: 谢谢flyycyu(fly) 不过我还想 有没有能直接引入一个.css文件的方法呢? ______________________________________________________________________________________________ 答4: 选择界面风格: <select onchange="document.styleSheets[0].href=this.options[this.selectedIndex].value+'.css'" id=select1 name=select1> <option value="Style/new">默认风格</option> <option value="Style/red">粉红风情</option> <option value="Style/blue">蓝色港湾</option> <option value="Style/black">灰暗忧郁</option> </select> ______________________________________________________________________________________________ 答5: 不过好像在帧里面修改别的帧页面里的css有时候会出现错误,以前XXM的页面动态改变css的时候就有这个问题,不知道现在解决没有。 ______________________________________________________________________________________________ 答6: OK 问题解决 多谢!
(编辑:网站学习网)
|