注册 登录
编程论坛 ASP.NET技术论坛

[求助]换背景图片

smofbao 发布于 2007-09-26 15:51, 474 次点击

有一个按纽(html)的
按纽是这样做的
<input id="aa" type="button" value="but" onclick="bb()" />
<script language="javascript" type="text/javascript">
bb()
{
aa.style.backgroundImage="url(icn/Arw03lt5.ico)";
aa.style.backgroundPosition="center top";
aa.style.backgroundColor="transparent";
aa.style.backgroundColor="red";
aa.style.display="none";
}
</script>

这样写改变按纽的背景图片,颜色等
在哪有问题。

2 回复
#2
jxnuwy042007-09-26 17:05
我发现的问题:是不bb()函数前要加function? 其他的不怎么懂就不太清楚了.
#3
smofbao2007-09-27 08:41
function bb()
{
document.getElementById("aa").style.backgroundImage="url(icn/Arw03lt5.ico)";
document.getElementById("aa").style.backgroundPosition="center top";
document.getElementById("aa").style.backgroundColor="transparent";
document.getElementById("aa").style.backgroundColor="red";
document.getElementById("aa").style.display="none";
}
改成这样就行了
1