注册 登录
编程论坛 WEB前端(UI)

[求助]如何用dreamweaver实现:鼠标移到按钮上去,背景颜色改变

renyy56 发布于 2007-04-21 17:21, 5310 次点击

当鼠标悬停在按钮上时 web页背景颜色改变,当鼠标离开按钮,背景色恢复?
如下是我的代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>

</head>

<body>
<center>
<input type="submit" name="Submit" value="背景改变" onMouseOver="doucument.bgcolor='red'; return ture"></center>


onmouseover="this.bgColor='#ffffff'" onmouseout="this.bgColor='#fdsafd'" 这一行我不知道放哪?

</body>
</html>

5 回复
#2
renyy562007-04-21 17:51
回复:(renyy56)[求助]如何用dreamweaver实现:鼠标...

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javaScript">
function chang(){
document.bgColor='red'
}
function old(){
document.bgColor='#FFFFFF'
</script>
</head>

<body>
<center><p onmousemover="chang()" onMouseOut="old()">
<font size="2" face="宋体">
<input type="submit" name="Submit" value="背景颜色改变">
</font></p></center>

</body>
</html>

我又写了一些代码,还是不行请指教。

这次的代码应该好一些,但不知道哪错了。

#3
lmhllr2007-04-22 02:14
你写的好复杂,一行代码就可以了吧!


<input type=\"submit\" value=\"背景颜色改变\" onMouseOver=\"document.bgColor='red'\"; onMouseOut=\"document.bgColor='#FFFFFF';\">
#4
sgliuxiu2007-04-22 23:22
高手
#5
renyy562007-04-25 11:04
回复:(lmhllr)你写的好复杂,一行代码就可以了吧![c...

谢谢你的指教,和我想象的功能一样。
但我想还改进一下:这个功能不在主体里实现在javascript实现。
嘿嘿,想多学点东西,
谢谢

#6
天上碑2007-04-25 14:29
学了一招.
1