<input onkeydown="if(event.keyCode==46)alert(document.selection.createRange().text)">
解决方案 »
- javascript怎么实现动态在某个<tr></tr>标签添加父标签。
- JS验证验证码?
- javascript如何判断页面内的某个对象是否存在?
- 下载数据库纪录时,出现的一幕.......,请高手指点。
- js滤镜渐变问题
- 请问在TextArea中如何能做到将选中的文字删除并且删除完成之后以下的文字要能自动提到前面来!
- 初涉JS,问个很简单的问题,寻求帮助。
- 当关闭窗口IE 的时候怎么记录用户退出的时间?怎么来触发这个事件?我的页面有FRAME。有Header,Footer,Body?
- 老问题,我要移动光标,前一个,后一个,怎么动
- js书籍,事件处理器有一些不懂请指点 ,web开发为什么要学这么多杂内容
- 大家用过window.open(本地路径+本地文件)来打开文件没有啊?
- Javascript有没有类似字符串处理的left函数??
function view(e)
{
if(!document.all) alert(e.which);
else alert(event.keyCode);
}if(!document.all){
if(document.getElementById) {//>=NS6.0
document.addEventListener("keypress", view, true);
}
} else {
document.onkeypress= view;
}
</SCRIPT>
46是.,不是Delete
to:: fason(阿信) ( )
你的程序不能显示出键值啊to:wangxiaomax(缺省值)
你的程序怎么使用啊
<script language="JavaScript">
function view(e){
if(!document.all) alert(e.which);
else alert(event.keyCode);
}if(!document.all){
if(document.getElementById) {//>=NS6.0
document.addEventListener("keydown", view, true);
}
} else {
document.onkeydown= view;
}
</SCRIPT>
<body onkeydown=alert(event.keyCode)>不就行了?
但是我删除的时候,他没有显示到我删除的键值是什么啊。
<html>
<head></head><body>
<script language="JavaScript">
function view(e)
{
if(!document.all) alert(e.which);
else alert(event.keyCode);
}if(!document.all){
if(document.getElementById) {//>=NS6.0
document.addEventListener("keypress", view, true);
}
} else {
document.onkeypress= view;
}
</SCRIPT>
<input type="text" onkeydown="view()">
</body>
</html>to:: fason(阿信) ( )
你的程序在使用的时候当我删除的时候他弹出的对话框没有任何的显示。
"他指的是显示删除的键的值。不是键值。"
对我就是要知道我用del删除了那一个键。象我如果删除了”c"那么就显示c就可以了。
确实是那样的,但是我不选择就直接删除就显示不出来了。比如我只是删除一个字符没有必要把他选中后在删除把
我是要知道我删除了的字符是什么,不是你写的那样。:)
<input id='txt' onkeydown="if(event.keyCode==46)alert(document.selection.createRange().text);v=value" value="fason" onkeyup="check(this)">
<script>
var v=document.all['txt'].value
function check(o){if(event.keyCode==8){
alert(v.replace(o.value,''))
v=o.value
}
}
</script>