原始网页:
<!DOCTYPE html>
<html><body>
<div οnmοuseοver="mOver(this)" οnmοuseοut="mOut(this)" style="background-color:green;width:120px;height:20px;padding:40px;color:#ffffff;">把鼠标移到上面</div>
<script>
function mOver(obj)
{
obj.innerHTML="谢谢"
}
function mOut(obj)
{
obj.innerHTML="把鼠标移到上面"
}
</script>
</body>
</html>
经过浏览器解析后:
<!DOCTYPE html> | |
<html> | |
<body> | |
<div onmouseover="mOver(this)" onmouseout="mOut(this)" style="background-color:green;width:120px;height:20px;padding:40px;color:#ffffff;">鎶婇紶鏍囩Щ鍒颁笂闈�</div> | |
<script> | |
function mOver(obj) | |
{ | |
obj.innerHTML="璋㈣阿" | |
} | |
function mOut(obj) | |
{ | |
obj.innerHTML="鎶婇紶鏍囩Щ鍒颁笂闈�" | |
} | |
</script> | |
</body> | |
</html> |
解决方法:
在<head>中加入<head><meta http-equiv="Content-Type" content="text/html; charset=utf8"></head>,问题解决。