怎么利用CSS给一个表单赋值

miaoliujun 2007-05-10 04:31:12
需要在表单中显示一段话,这段话从CSS的定义中得到,请问如何实现?
...全文
205 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
miaoliujun 2007-05-10
  • 打赏
  • 举报
回复
感谢
miaoliujun 2007-05-10
  • 打赏
  • 举报
回复
自己找到解决方案了
#p:before{
content:"Powered by Me"
}
miaoliujun 2007-05-10
  • 打赏
  • 举报
回复
这种貌似在FireFox不支持
RexZheng 2007-05-10
  • 打赏
  • 举报
回复
<html>
<head>
<title></title>
<style>
body {
background: ghostwhite;
}
#t {
width: 500px;
height: 200px;
content:Just have a test!;
}
</style>

<script language="JavaScript">
window.onload = function()
{
//document.getElementById("t").value = document.styleSheets[0].cssText;
document.getElementById("t").value = document.styleSheets[0].rules[1].style.content;
}
</script>
</head>
<body>
<textarea id="t"></textarea>
</body>
</html>
miaoliujun 2007-05-10
  • 打赏
  • 举报
回复
最好firefox也支持
miaoliujun 2007-05-10
  • 打赏
  • 举报
回复
谢谢楼上,我想进一步问个问题
我不是想输出整个class的内容,能否在class里自定义一个属性,并将这个输出来,
比如:
#t {
width: 500px;
height: 200px;
content:Just have a test!;
}

页面就输出Just have a test!,其他的样式按照定义的来显示。

再次谢谢楼上
RexZheng 2007-05-10
  • 打赏
  • 举报
回复
<html>
<head>
<title></title>
<style>
body {
background: ghostwhite;
}
#t {
width: 500px;
height: 200px;
}
</style>

<script language="JavaScript">
window.onload = function()
{
//document.getElementById("t").value = document.styleSheets[0].cssText;
document.getElementById("t").value = document.styleSheets[0].rules[1].style.cssText;
}
</script>
</head>
<body>
<textarea id="t"></textarea>
</body>
</html>

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧