请教一个很难的问题

CalvinDotNet 2002-11-13 05:09:22
请问如何用javascript或css使一个表格
无论背景色如何变,文本色都是背景色的反色呢
谢谢..
...全文
34 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
CalvinDotNet 2002-11-14
  • 打赏
  • 举报
回复
也是不行啊,能给个具体的例子吗
seabell 2002-11-14
  • 打赏
  • 举报
回复
sorry
<script>
function setcolor()
{
bgcolor=document.all.mytext.style.background.substr(1);
document.all.mytext.style.color=0xffffff-bgcolor;
}
</script>
<input type=text id=mytext>
<input type=button value=red onclick="document.all.mytext.style.background='#FF6142';setcolor()">
<input type=button value=green onclick="document.all.mytext.style.background='#42E3D6';setcolor()">
<input type=button value=lilac onclick="document.all.mytext.style.background='#E7E7FF';setcolor()">
<input type=button value=black onclick="document.all.mytext.style.background='#000000';setcolor()">
seabell 2002-11-14
  • 打赏
  • 举报
回复
<script>
function setcolor()
{
bgcolor=document.all.mytext.style.background.substr(1);
document.all.mytext.style.color=0xffffff-bgcolor;
}
</script>
<input type=text id=mytext onPropertyChange="setcolor(this)">
<input type=button value=red onclick="document.all.mytext.style.background='#FF6142';setcolor()">
<input type=button value=green onclick="document.all.mytext.style.background='#42E3D6';setcolor()">
<input type=button value=lilac onclick="document.all.mytext.style.background='#E7E7FF';setcolor()">
<input type=button value=black onclick="document.all.mytext.style.background='#000000';setcolor()">
qiushuiwuhen 2002-11-13
  • 打赏
  • 举报
回复
try highlight or highlighttext
CalvinDotNet 2002-11-13
  • 打赏
  • 举报
回复
这是颜色是固定了的
文本色能不能自动生成?
flylyke 2002-11-13
  • 打赏
  • 举报
回复
td{background-color:#996633;color: #345456}

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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