试过用
<input type=text onkeyup="bbb.value=this.value;" onkeypress="if (event.ctrlKey && event.keyCode==90){document.execCommand('Undo')}">
但ctrl+z仍然是不起作用。
<input type=text onkeyup="bbb.value=this.value;" onkeypress="if (event.ctrlKey && event.keyCode==90){document.execCommand('Undo')}">
但ctrl+z仍然是不起作用。
<input type=text onblur="bbb.value=this.value">
function KeyUp(e)
{
e=e||event;
alert(e.ctrlKey);
}
</script>
<input type=text onkeydown="KeyUp(event)">
不知道是不是IE上的这些事件和ctrl+z撤消功能产生冲突造成的。
这问题困扰我有一段时间了,终使找不到好的解决办法。
----------------------->
<input type=text onpropertychange="bbb.value=this.value;"> <input type=text name=bbb>
汗.........
<input type=text onkeydown="if (event.ctrlKey){alert(event.keyCode);}">
能输出ctrl的键值。
http://download.csdn.net/source/346399
\JKHtml\JKValidation\JKValidationDemo-SoftAlertWhenBlur.htm
<input type=text onblur="setTextInputValue(document.all.bbb,this.value);"> <input type=text name=bbb> <script>
/**
* setTextInputValue
*/
function setTextInputValue(obj,value) // For IE: To keep Undo after change value.
{
if(obj.createTextRange) obj.createTextRange().text=value;
else obj.value=value;
}
</script>
再如CSDN的回贴textarea区域,竟然连undo都不支持
都显得过于粗略,没有认真为用户着想.
/**
* setTextInputValue
*/
function setTextInputValue(obj,value) // For IE: To keep Undo after change value.
{
if(obj.createTextRange) obj.createTextRange().text=value;
else obj.value=value;
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页</title>
<style type="text/css">
body{
font-size:14px;
}
</style>
</head>
<body>
IE6下測式結果:<p>
請分別在下面輸入一些文字後,兩秒內 和 兩秒後 按Ctrl+Z;<p>
兩秒後賦值somestr:<input type=text onkeyup="window.setTimeout(function(){b1.value='somestr'},2000);"> <input type=text name=b1><p>
兩秒後賦一空值:<input type=text onkeyup="window.setTimeout(function(){b2.value=''},2000);"> <input type=text name=b2><p>
<p>會發現:
第一排輸入框,輸入內容後,在未給bbb賦值前(2秒內),按Ctrl+z是正常的,2秒後,給bbb賦值,無效了。<br>
第二排輸入框,輸入內容後,2秒前和2秒後ctrl+z都正常。<p>
估計是IE6一個BUG!
</body>
</html>
<script language="javascript">
function function1()
{
var aaa1 = document.getElementById("aaa").value;
document.getElementById("bbb").value=aaa1;
}
</script>
<form action="##" method="post">
<input type="text" name="aaa" onchange="function1();">
<input type="text" name="bbb">
</form>
http://www.blogjava.net/emu/archive/2005/09/28/14314.html希望对你有点帮助。
谢谢各位达人的热忱帮忙!特别是JK_10000的帮助!
虽然我的问题仍没解决,但已经解决了我这个贴子提出的问题。所以结贴!
我重新提出了新贴:
http://topic.csdn.net/u/20080219/18/be723a00-3731-43d9-aee3-86bd6db1cdea.html?seed=1558258024
希望各位达人能再帮我真正的解决这个问题。