<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<body>
<script language="javascript">
var seltxt = '';
function check() {
alert(seltxt);
}
function getSelText(o) {
o.focus();
if (typeof document.selection != "undefined") {
return document.selection.createRange().text;
} else {
return o.value.substr(o.selectionStart, o.selectionEnd
- o.selectionStart);
}
}
function save() {
alert(window.event.ctrlKey + "window.event.ctrlKey");
alert(window.event.keyCode + "window.event.keyCode")
if (window.event.keyCode == 13 && window.event.ctrlKey) {
//document.Form1.submit();
check();
}
}
document.onkeydown = function(e) {
e = e ? e : window.event;
var keyCode = e.which ? e.which : e.keyCode;
if (e.ctrlKey && keyCode == 13)
alert("Hello World!");
}
</script>
<textarea cols="50" rows="10" name="description"
onselect="javascript:seltxt=getSelText(this);">你好!请选择我提交</textarea>
<input type="button" value="提交" onclick="check()" />
</body>
<body>
<script language="javascript">
var seltxt = '';
function check() {
alert(seltxt);
}
function getSelText(o) {
o.focus();
if (typeof document.selection != "undefined") {
return document.selection.createRange().text;
} else {
return o.value.substr(o.selectionStart, o.selectionEnd
- o.selectionStart);
}
}
function save() {
alert(window.event.ctrlKey + "window.event.ctrlKey");
alert(window.event.keyCode + "window.event.keyCode")
if (window.event.keyCode == 13 && window.event.ctrlKey) {
//document.Form1.submit();
check();
}
}
document.onkeydown = function(e) {
e = e ? e : window.event;
var keyCode = e.which ? e.which : e.keyCode;
if (e.ctrlKey && keyCode == 13)
alert("Hello World!");
}
</script>
<textarea cols="50" rows="10" name="description"
onselect="javascript:seltxt=getSelText(this);">你好!请选择我提交</textarea>
<input type="button" value="提交" onclick="check()" />
</body>