文本框ctrl+s点击事件和文本变化事件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <textarea id="txtView" name="txtView">aaaa</textarea> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> var len = 0; $("#txtView").bind("input propertychange",function(){ var l = $(this).val().length; if(len!= l){ alert("文本发生变化"); len = l; } }); document.getElementById("txtView").onkeydown=function(){ var oEvent = event; if (oEvent.keyCode == 83 && oEvent.ctrlKey) { event.preventDefault() //只要你定义了这些键的动作,你在浏览器里按下这些键就会响应,兼容目前所有浏览器。 //这里只能用alt,shift,ctrl等去组合其他键event.altKey、event.ctrlKey、event.shiftKey 属性 alert("点击了保存"); } }; </script> </body> </html>
疯狂的妞妞 :每一天,做什么都好,不要什么都不做!