HTML事件绑定

<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
<title>HTML Event Bindings</title>
 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
</head>
 
<body onload='alert("Event demo loaded");' onunload='alert("Leaving demo");'>
 
<h1 align="center">HTML Event Bindings</h1>
 
<form action="#" method="get" onreset="alert('Form reset');"
 
      onsubmit="alert('Form submit');return false;">
 
<ul>
 
<li>onblur: 
 
<input type="text" value="Click into field and then leave"
 
 size="40" onblur="alert('Lost focus');" /><br /><br /></li>
 
<li>onclick: <input type="button" value="Click me" 
 
onclick="alert('Button click');" /><br /><br /></li>
 
 
 
<li>onchange: <input type="text" value="Change this text then leave"
 
 size="40" onchange="alert('Changed');" /><br /><br /></li>
 
 
 
<li>ondblclick: <input type="button" value="Double-click me"
 
 ondblclick="alert('Button double-clicked');" /><br /><br /></li>
 
 
 
<li>onfocus: <input type="text" value="Click into field"
 
 onfocus="alert('Gained focus');" /><br /><br /></li>
 
<!-- Ö¸Ã÷ÔÚµ±Ç°Óн¹µãµÄ±ê¼ÇÖа´Ï¼ü -->
<li>onkeydown: 
 
<input type="text" value="Press key and release slowly here" size="40"
 
 onkeydown="alert('Key down');" /><br /><br /></li>
 
 
<!-- Ö¸Ã÷ÔÚµ±Ç°Óн¹µãµÄ±ê¼ÇÖа´Ï¼ü²¢ÊÍ·Å -->
<li>onkeypress: 
 
<input type="text" value="Type here" size="40" onkeypress="alert('Key pressed');" /><br /><br /></li>
 
 
<!-- Ö¸Ã÷ÔÚµ±Ç°Óн¹µãµÄ±ê¼ÇÖÐÊͷżü -->
<li>onkeyup: <input type="text" value="Press a key and release it" size="40"
 
 onkeyup="alert('Key up');" /><br /><br /></li>
 
<li>onload:  An alert was shown when the document loaded.<br /><br /></li>
 
 
 
<li>onmousedown: 
 
<input type="button" value="Click and hold" onmousedown="alert('Mouse down');" /><br /><br /></li>
 
<li>onmousemove: Move mouse over this
 
<a href="#" onmousemove="alert('Mouse moved');">link</a><br /><br /></li>
 
 
 
<li>onmouseout: Position mouse 
 
<a href="#" onmouseout="alert('Mouse out');">here</a> and then away.
 
<br /><br /></li>
 
<li>onmouseover: Position mouse over this 
 
<a href="#" onmouseover="alert('Mouse over');">link</a><br /><br /></li>
 
<li>onmouseup: 
 
<input type="button" value="Click and release"
 
  onmouseup="alert('Mouse up');" /><br /><br /></li>
 
<li>onreset: <input type="reset" value="Reset Demo" /><br /><br /></li>
 
<li>onselect: <input type="text" value="Select this text" size="40"
 
                     onselect="alert('selected');" /><br /><br /></li>
 
<li>onsubmit: <input type="submit" value="Test submit" /><br /><br /></li>
 
<li>onunload: Try to leave document by following this 
 
              <a href="http://www.google.com">link</a><br /><br /></li>
 
</ul>
 
</form>
 
</body>
 
</html>

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值