<img src="http://file.wbgxw.com/UpLoadPic/2007-7/2007771721567">

让处于contentEditable=true的层里面的图片响应键盘事件

80酷酷网    80kuku.com

  响应<SCRIPT LANGUAGE=javascript FOR=document EVENT=onkeyup>
ku()
</SCRIPT>
<div id="eee" >
<img src="http://file.wbgxw.com/UpLoadPic/2007-7/200777172156747.gif">asdfasdfasdfas
<input type="text" value="aa">adfasdf
</div>
<script language="javascript">
eee.contentEditable=true

document.onkeyup=kd()
function ku(){
var oControlRange = document.selection.createRange();
if (oControlRange(0).tagName.toUpperCase() == "IMG") {
alert("您在图片上按了键!")
}
}
</script>















分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: