居然提示是上一行的错误,“对象不支持此属性或方法”
(上一行是<td>啥的,肯定不是提示行的错)
(上一行是<td>啥的,肯定不是提示行的错)
解决方案 »
- dhtmlxTree中文乱码问题。
- js文档怎么调用,我是新手.......
- 求一个JQ可直接编辑的表格插件!急急急!
- 大家推荐几本JavaScript编程的书籍
- 那位有javascript的编辑工具呀,能传给我一份吗?
- javascript应答窗口的方式能回传数据吗???window.showModalDialog("test.aspx?父亲页面的控件值=×××")
- 关于下拉菜单??????急急急!!!!!!!!!1
- Ext4 调用RowEditing的StartEdit之后,ComboBox显示值的问题
- 敲了一晚上!为什么我两个函数运行不起来?!主要是setInterval('timer()',100);setInterval('runClock()',100)
- js对象浅拷贝的问题
- insertCell()之后,如何给<TD>设id值?
- 用insertRow插入的表格的行,怎么给他加入事件?谢!
<form action="lyok.asp" name="haha" method="post" onsubmit="alert('表单已提交!');return false;">
<textarea rows="4" name="cword" cols="49" onkeydown="if(event.ctrlKey && event.keyCode==13) document.postart.submit();"></textarea>
<input type="submit" value="提交" name="submit">
</form>
</body>
看这样可以不?
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
function test(){if(window.event.keyCode==13&&window.event.ctrlKey){
document.haha.submit();
}
}</script>
</HEAD><BODY>
<body onkeydown="test();">
<form action="lyok.asp" name="haha" method="post" >
<textarea rows="4" name="cword" cols="49"></textarea>
<input type="submit" value="提交" >
</form>
</body></BODY>
</HTML>
可是ctrl+enter直接提交表单,并不执行checkadd()函数。(代码如下)
如果用按钮提交,就会执行checkadd()函数进行判断。
<form action="lyok.asp" method="post" name="postart" onsubmit="return checkadd()">
<input type="text" name="cname">
<textarea name="cword" onkeydown="javascript:if(event.ctrlKey && event.keyCode==13) document.postart.submit();">
<input type="submit" value="提交">
</form>chechadd()函数判断cname的文本框输入不为不空。
<script language="javascript">
<!--
function checkadd()
{
if(document.postart.cname.value.length<1)
{
alert("请填写昵称!");
document.postart.cname.focus();
return false;
}
}
-->
</script>
还需要各位大侠帮忙解决:(
onkeydown="javascript:if(event.ctrlKey && event.keyCode==13&&checkadd())document.postart.submit();"
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
function test(){if(window.event.keyCode==13&&window.event.ctrlKey){
if(checkadd()){
document.haha.submit();
}
}
}
function checkadd()
{
if(document.haha.cword.value.length<1)
{
alert("请填写昵称!");
document.haha.cword.focus();
return false;
}
}</script>
</HEAD><BODY>
<body onkeydown="test();">
<form action="lyok.asp" name="haha" method="post" onsubmit="return checkadd();">
<textarea rows="4" name="cword" cols="49"></textarea>
<input type="submit" value="提交" >
</form>
</body></BODY>
</HTML>
牛人的办法解决了ctrl+enter提交时执行checkadd()判断,可是它提示两遍“请填写昵称!”
当在canme填写好昵称后,按ctrl+enter键提交没反应了……,这会应该是正确提交不是么?为什么却没反应?
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
function test(){if(window.event.keyCode==13&&window.event.ctrlKey){
if(checkadd()){
document.haha.submit();
}else{
document.haha.cword.focus();
window.event.keyCode=8;
}
}
}
function checkadd()
{
if(document.haha.cword.value.length==0)
{
alert("请填写昵称!");
document.haha.cword.focus();
document.haha.cword.value="";
return false;
}else{
return true;
}
}</script>
</HEAD><BODY>
<body onkeydown="test();">
<form action="lyok.asp" name="haha" method="post" onsubmit="return checkadd();">
<textarea rows="4" name="cword" cols="49"></textarea>
<input type="submit" value="提交" >
</form>
</body></BODY>
</HTML>
cname和cmail框判断了,也响应ctrl enter事件
可是到了cword框就不响应了。怪了,怎么这么怪?
请问window.event.keyCode=8;
这句代码是什么作用?
if(document.haha.cword.value.length==0)
=〉
if(document.haha.cword.value=="")
<!--
function checkadd()
{
if(document.postart.cname.value.length<1)
{
alert("请填写昵称!");
document.postart.cname.focus();
return false;
}
if(document.postart.cmail.value.length<1)
{
alert("请填写电子邮箱!");
document.postart.cmail.focus();
return false;
}
if ( (document.postart.cmail.value).search("@")== -1 )
{
alert("请正确填写邮箱地址!");
document.postart.cmail.focus();
return false;
}
if(document.postart.cword.value.length<1)
{
alert("请填写留言内容!");
document.postart.cword.focus();
return false;
}
if(document.postart.cword.value.length>100)
{
alert("留言内容应少于100字!");
document.postart.cword.focus();
return false;
}
}function test(){
if(window.event.keyCode==13&&window.event.ctrlKey){
if(checkadd()){
document.postart.submit();
}else{
window.event.keyCode=8;
}
}
}
-->
</script>
<body onkeydown="test();">
<form action="lyok.asp" method="post" name="postart" onsubmit="return checkadd()">
<input type="text" name="cname" size="30" maxlength="50" style="border: 1 solid #000000">
<input type="text" name="cmail" size="30" maxlength="50" style="border: 1 solid #000000">
<textarea rows="4" name="cword" cols="49" style="border: 1 solid #000000" title="可以使用Ctrl+Enter直接提交"></textarea>
<input type="submit" value="提交">
<input type="reset" value="取消" name="reset"></form>
</body>
各位大侠真是好人,本人感动得痛哭流涕:)
其他代码就是有关asp的了,应该不是asp的错误吧:(
function test(){
if(window.event.keyCode==13&&window.event.ctrlKey){
if(checkadd())//注意这个地方!!!!!!!!!!!!!!
{
document.haha.submit();
}
}
}
function checkadd()
{
if(document.haha.cword.value.length<1)
{
alert("请填写昵称!");
document.haha.cword.focus();
return false;
}
//看看这个地方!!!!!!!!!!!
}
看出来了吗???
如果满足提交条件function checkadd()并没有返回值!当然test()不会有什么动作啦!
在function checkadd()我的注释前边的地方写:return true;
{
if(document.haha.cword.value.length==0)
{
alert("请填写昵称!");
document.haha.cword.focus();
document.haha.cword.value="";
return false;
}else{
return true; ////这里 需要写的!
}
}