一个弱弱的问题,改变背景色.

hbjmdx008 2006-10-25 03:36:49
<table>
<tr id="tr1" bgcolor="#999999">
<td id="aaa" width="24" >aaa</td>
<td bgcolor="#006633">ccc</td>
</tr>
</table>
<script type="text/javascript">
<!--
document.getElementById("tr1").style.backgoundColor="#Fc3300";
document.getElementById("aaa").style.backgoundColor="#ffffff";
//-->
</script>

为何这两个都不变色呢????
...全文
324 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
chinasoft_b 2006-10-26
  • 打赏
  • 举报
回复
<body onload="abb()">
<table>
<tr>
<td id="aaa" bgcolor=blue >aaa</td>
<td id="ccc" bgcolor="#006633">ccc</td>
</tr>
</table>
</body>
<script type="text/javascript">
<!--
function abb(){
document.getElementById("aaa").style.background="red";
document.getElementById("ccc").style.background="yellow";
}
//-->
</script>
PaulLeder 2006-10-26
  • 打赏
  • 举报
回复
document.bgColor="";
msf40906890 2006-10-26
  • 打赏
  • 举报
回复
汗.....................
懒牛科技 2006-10-25
  • 打赏
  • 举报
回复
呵呵,楼上对得!
sytle.background才是对得!
lz注意了!
X27794797 2006-10-25
  • 打赏
  • 举报
回复
background 这个属性才是对的
shangu 2006-10-25
  • 打赏
  • 举报
回复
我冷........原来楼主写错了.......

shangu 2006-10-25
  • 打赏
  • 举报
回复
<SCRIPT>
function fnGetId(){
document.getElementById("oDiv1").style.backgroundColor="#000000";
//alert("sfsa");
}
</SCRIPT>
<DIV ID="oDiv1">Div #1</DIV>
<DIV ID="oDiv2">Div #2</DIV>
<DIV ID="oDiv3">Div #3</DIV>
<INPUT TYPE="button" value="kao" onclick="javascript:fnGetId()">
descreekert 2006-10-25
  • 打赏
  • 举报
回复
document.getElementById("tr1").style.backgoundColor="#Fc3300";

backgoundColor错了,应该是backgroundColor
SimpleDay 2006-10-25
  • 打赏
  • 举报
回复
document.getElementById("tr1").style.background="#Fc3300";
改成BACKGROUND
hbjmdx008 2006-10-25
  • 打赏
  • 举报
回复
<table>
<tr id="tr1" bgcolor="#999999">
<td id="aaa" width="24" >aaa</td>
<td bgcolor="#006633">ccc</td>
</tr>
</table>
<script type="text/javascript">
<!--
function fun(){
document.getElementById("tr1").style.backgoundColor="#Fc3300";
document.getElementById("aaa").style.backgoundColor="#ffffff";
}
//-->
</script>
<form name="form1" method="post" action="">

<input type="button" name="button" onClick="fun()" value="aa">

</form>

这样算有事件了吗,也还不行。
hbjmdx008 2006-10-25
  • 打赏
  • 举报
回复
原来是在一个事件中的,可是太长,我没写。

shangu 2006-10-25
  • 打赏
  • 举报
回复
要有事件,才可以啊

要不就是onload
要不就是onmouseover等等,才回激发变颜色
hbjmdx008 2006-10-25
  • 打赏
  • 举报
回复
自已UP先。。。。
可以称为标签。用<>括起来的一个特定的单词。标签分为单标签和双标签。单标签:双标签:标签中可以加入属性,双标签中可以继续嵌套标签。用HTML标签写出的文件保存为.html文件,称为页面文件什么是标签的属性在标签中,通过加入属性名="属性值" ,就可以让某个标签拥有指定的特征。<标签名 属性1="值" 属性2="值" >

87,917

社区成员

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

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