jquery常用事件

来源:互联网 发布:mac 安装sass 编辑:程序博客网 时间:2024/06/14 16:40
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title><style type="text/css">#e02{border: 1px solid #000000;  height: 200px; width: 200px;}</style><script type="text/javascript" src="../js/jquery-1.8.3.js"></script><script type="text/javascript">$(document).ready(function(){$("#e01").blur(function(){$("#textMsg").html("文本框失去焦点:blur");}).focus(function(){$("#textMsg").html("文本框获得焦点:focus");}).keydown(function(){$("#textMsg").append("键盘按下:keydown");}).keypress(function(event){$("#textMsg").append("键盘按下:keypress");}).keyup(function(){$("#textMsg").append("键盘按下:keyup");}).select(function(event){//支持谷歌var sub = $(this).val().substring(event.target.selectionStart,event.target.selectionEnd);$("#textMsg").html("文本内容被选中:select , " + sub);});var i = 0;$("#e02").mouseover(function(){$("#divMsg").html("鼠标移上:mouseover");}).mousemove(function(){$("#divMsg").html("鼠标移动:mousemove , " + i++ );}).mouseout(function(){$("#divMsg").html("鼠标移出:mouseout");}).mousedown(function(){$("#divMsg").html("鼠标按下:mousedown");}).mouseup(function(){$("#divMsg").html("鼠标弹起:mouseup");});$("#e03").click(function(){$("#buttonMsg").html("单击:click");}).dblclick(function(){$("#buttonMsg").html("双击:dblclick");});});</script></head><body><input id="e01" type="text" /><span id="textMsg"></span> <br/><hr/><div id="e02" ></div><span id="divMsg"></span> <br/><hr/><input id="e03" type="button" value="可以点击"/><span id="buttonMsg"></span> <br/></body></html>

0 0
原创粉丝点击