如何把文本框里面的CSS应用到当前页面?
时间:2010-05-21
来源:互联网
我一个文本框里面有很多CSS代码,但是我发现JS只能控制一个CSS属性。
如果过一个文本框里面是下面的CSS,如何应用到当前页面呢??
如果过一个文本框里面是下面的CSS,如何应用到当前页面呢??
复制内容到剪贴板
body{ font-size:14px; color:#666666; line-height:1.8em;}
a{ color:#666699; text-decoration:none}
a:hover{ background:#666699; color:#FFFFFF}
th{ color:#FFFFFF; padding:5px; background:#666699}
h1,h2{ font-size:24px; color:#FF9900; line-height:2em;}
h2{font-size:18px;}
#phonezip ul li{ display:inline; list-style:none; color:#990000; font-size:14px; text-align:left;}
.hear{ font-size:14px;}
.hear a{}
#logo{ height:60px; text-align:right;}
#logo a{ font-size:36px; font-family:Verdana, Arial, Helvetica, sans-serif; line-height:150%; font-weight:bold;
background:#666699; color:#FFFFFF}
#logo a span{ color:#fff; background:#FF9900; padding:0 5px;}
.foot { font-size:12px; text-align:center ; height:60px; border-top:1px solid #eee; padding:10 0;}
table,td,th{border-collapse:collapse; border:1px solid #CCCCCC;padding:3px 0; text-align:center;}
.shoucang {text-align:right; font-size:12px; padding:5px; color:blue;}
.hh{ margin:10px 0;}
.baidu span{font-size:12px; color:#999}
.cle{clear:both;}
.head h1{line-height:60px;}
.news_an { font-size:12px; color:#999; border:1px dotted #ddd;}
.news_an a{background:green; color:#fff;padding:2px 5px;}
.news_an a:hover{background:#ff9900;}
p strong { display:block;}
.red{color:red}
table th{width:11%;}
.txtad { font-size:15px; text-align:center;}
.red{color:red}
.blue{color:blue}
.green{color:green}
.s10{height:10px; clear:both;}
.nav {border-bottom:1px dotted #666699;}
.nav ul{padding:5px 0; width:100%; clear:both}
.nav ul li{ float:left; width:55px; height:16px; text-align:center; border-right:1px dotted #eee; line-height:16px;}
.nav ul li a{color:#666699; display:block;}
.nav ul li a:hover{color:#fff; background:#ff9900}
.jl {border-top:1px dotted #ff9900; border-bottom:1px dotted #ff9900; background:#FFE6BF}
代码:
body,p,h1,h2,h3,form,ul,li{padding:0px; margin:0px;list-style:none;}body{ font-size:14px; color:#666666; line-height:1.8em;}
a{ color:#666699; text-decoration:none}
a:hover{ background:#666699; color:#FFFFFF}
th{ color:#FFFFFF; padding:5px; background:#666699}
h1,h2{ font-size:24px; color:#FF9900; line-height:2em;}
h2{font-size:18px;}
#phonezip ul li{ display:inline; list-style:none; color:#990000; font-size:14px; text-align:left;}
.hear{ font-size:14px;}
.hear a{}
#logo{ height:60px; text-align:right;}
#logo a{ font-size:36px; font-family:Verdana, Arial, Helvetica, sans-serif; line-height:150%; font-weight:bold;
background:#666699; color:#FFFFFF}
#logo a span{ color:#fff; background:#FF9900; padding:0 5px;}
.foot { font-size:12px; text-align:center ; height:60px; border-top:1px solid #eee; padding:10 0;}
table,td,th{border-collapse:collapse; border:1px solid #CCCCCC;padding:3px 0; text-align:center;}
.shoucang {text-align:right; font-size:12px; padding:5px; color:blue;}
.hh{ margin:10px 0;}
.baidu span{font-size:12px; color:#999}
.cle{clear:both;}
.head h1{line-height:60px;}
.news_an { font-size:12px; color:#999; border:1px dotted #ddd;}
.news_an a{background:green; color:#fff;padding:2px 5px;}
.news_an a:hover{background:#ff9900;}
p strong { display:block;}
.red{color:red}
table th{width:11%;}
.txtad { font-size:15px; text-align:center;}
.red{color:red}
.blue{color:blue}
.green{color:green}
.s10{height:10px; clear:both;}
.nav {border-bottom:1px dotted #666699;}
.nav ul{padding:5px 0; width:100%; clear:both}
.nav ul li{ float:left; width:55px; height:16px; text-align:center; border-right:1px dotted #eee; line-height:16px;}
.nav ul li a{color:#666699; display:block;}
.nav ul li a:hover{color:#fff; background:#ff9900}
.jl {border-top:1px dotted #ff9900; border-bottom:1px dotted #ff9900; background:#FFE6BF}
作者: cssbbs 发布时间: 2010-05-21
<style>复制到这里</style> 让后方到<HEAD></HEAD>之间
作者: Sunflowamedia 发布时间: 2010-05-21
<head>
<title></title>
<script type="text/javascript">
function loadFile(filePath, type){
var element=null;
if (type=="js"){
element=document.createElement('script')
element.setAttribute("type","text/javascript")
element.setAttribute("src", filePath)
}else if (type=="css"){
element=document.createElement("link")
element.setAttribute("rel", "stylesheet")
element.setAttribute("type", "text/css")
element.setAttribute("href", filePath)
}else{
return ;
}
var eHead=document.getElementsByTagName("head");
if(eHead!=null)
eHead[0].appendChild(element)
}
</script>
</head>
文章出处:飞诺网(http://www.firnow.com):http://dev.firnow.com/course/1_web/css/cssjs/200863/121097.html
<title></title>
<script type="text/javascript">
function loadFile(filePath, type){
var element=null;
if (type=="js"){
element=document.createElement('script')
element.setAttribute("type","text/javascript")
element.setAttribute("src", filePath)
}else if (type=="css"){
element=document.createElement("link")
element.setAttribute("rel", "stylesheet")
element.setAttribute("type", "text/css")
element.setAttribute("href", filePath)
}else{
return ;
}
var eHead=document.getElementsByTagName("head");
if(eHead!=null)
eHead[0].appendChild(element)
}
</script>
</head>
文章出处:飞诺网(http://www.firnow.com):http://dev.firnow.com/course/1_web/css/cssjs/200863/121097.html
作者: realalu 发布时间: 2010-05-21
谢谢你,不过我要的不是这个,是加载内部CSS代码,这些代码都在文本框中,不是一个文件。不知道怎样能够实现?
作者: cssbbs 发布时间: 2010-05-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28