1. 程式人生 > >49.按鈕只能單擊一次,鼠標事件

49.按鈕只能單擊一次,鼠標事件

down html size src 嵌入 sna gif mouse utf

技術分享
 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        onmousemove="this.className=‘over‘;"
23        onmouseout="this.className=‘‘;"
24        onmousedown="this.className=‘down‘;"
25        onmouseup="this.className=‘over‘;"
26        value="讓按鈕嵌入"
27        onclick="this.value=‘嵌入成功!‘"
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"
onmousemove="this.className=‘over‘;"
onmouseout="this.className=‘‘;"
onmousedown="this.className=‘down‘;"
onmouseup="this.className=‘over‘;"
value="讓按鈕嵌入"

onclick="this.value=‘嵌入成功!‘"

/>


<!--2.按鈕只能單擊一次-->
<button onclick="this.disabled=true">單擊</button>


</body>
</html>

49.按鈕只能單擊一次,鼠標事件