黑马程序员技术交流社区
标题:
javascript 为什么实现不了动态交互功能?
[打印本页]
作者:
追寻Dream
时间:
2013-10-20 16:18
标题:
javascript 为什么实现不了动态交互功能?
本帖最后由 追寻Dream 于 2013-10-20 16:30 编辑
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
h1{background:blue;}
.blue{ background:red;}
</style>
<script type="text/javascript">
window.onload=function(){
var main=document.getElementById('main');{
main.onmouseover=function(){
this.className="blue";
}
main.onmousemove=function(){
this.className="";
}
}
}
</script>
</head>
<body >
<h1 id="main">网站导航</h1>
</body>
</html>
怎么实现不了动态交互功能,求指导?
作者:
aihuahuaxx
时间:
2013-10-20 18:38
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
h1 {
background:blue;
}
.blue {
background:red;
}
</style>
<script type="text/javascript">
window.onload=function()
{
var main=document.getElementById('main');
main.onmouseover=function()
{
this.className="blue";
}
main.onmouseout=function()
{
this.className="";
}
}
</script>
</head>
<body >
<h1 id="main">网站导航</h1>
</body>
</html>
复制代码
onmouseout才是离开
作者:
追溯客
时间:
2013-10-23 09:14
如问题被解决,请及时把分类设为"已解决",黑马有你更精彩!
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2