鼠标光标移动

<!DOCTYPE html>
<html>
<head>
	<title>鼠标光标</title>
<style>
	.mouse{
		width: 100px;
        height: 100px;
        border:1px solid red; 
        padding-top: 50px;
        background-color: red;
        text-align: center;
	}
</style>
</head>
<body>
<div class="mouse" onmouseover ="over(this)" onmouseout="out(this)">click on me!</div>

<script type="text/javascript">
	function over(obj){
         obj.innerHTML="thank you!";
	}
	function out(obj){
		obj.innerHTML="click on me!";
	}
</script>
</body>
</html>

几个注意点:

1、只更改内容不更改样式。obj.innerHTML(更改元素内容)

2、光标移入移出:onmouseover(),onmouseout()

猜你喜欢

转载自blog.csdn.net/qq_35142645/article/details/83269214