首页 > 代码库 > 49.按钮只能单击一次,鼠标事件

49.按钮只能单击一次,鼠标事件

技术分享
 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4     <meta charset="UTF-8">
 5     <title></title>
 6     <style>
 7         .over {
 8             color: yellow;
 9             background: #7a7280;
10         }
11 
12         .down {
13             color: yellow;
14             background: #7a7280;
15             font-style: italic;
16         }
17     </style>
18 </head>
19 <body>
20 <!--1.鼠标移入移出事件-->
21 <input type="button"
22        onm ousemove="this.className=‘over‘;"
23        onm ouseout="this.className=‘‘;"
24        onm ousedown="this.className=‘down‘;"
25        onm ouseup="this.className=‘over‘;"
26        value="http://www.mamicode.com/让按钮嵌入"
27        onclick="this.value=http://www.mamicode.com/‘嵌入成功!‘"
28 
29         />
30 
31 
32 <!--2.按钮只能单击一次-->
33 <button onclick="this.disabled=true">单击</button>
34 
35 
36 </body>
37 </html>
View Code

 

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
.over {
color: yellow;
background: #7a7280;
}

.down {
color: yellow;
background: #7a7280;
font-style: italic;
}
</style>
</head>
<body>
<!--1.鼠标移入移出事件-->
<input type="button"
onm ousemove="this.className=‘over‘;"
onm ouseout="this.className=‘‘;"
onm ousedown="this.className=‘down‘;"
onm ouseup="this.className=‘over‘;"
value="http://www.mamicode.com/让按钮嵌入"
onclick="this.value=http://www.mamicode.com/‘嵌入成功!‘"

/>


<!--2.按钮只能单击一次-->
<button onclick="this.disabled=true">单击</button>


</body>
</html>

49.按钮只能单击一次,鼠标事件