首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    javascript当中表单提交(空格提交的问题)

    4.表单提交(空格提交的问题) 例 4.1(form.submitIEFF.html) <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script language=javascript> function check() { var form = document.getElementById("regForm"); if (form.user.value == "") { alert("用户名不能为空!"); } else { form.submit(); } } </script> <form method=post id="regForm" action="jsp1.jsp"> 用户<input type="text" name="user"/>
    <INPUT TYPE="button" onclick="check();" id="regBut" value="提交"/> </form> 以上例子很好,但有个问题,当光标放在文本框里时,即使空格,回车也会提交。不信你试试,浏览器(IE和火狐)都这样。下面给出解决办法。 例 4.1_a <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script language=javascript> function check() { var form = document.getElementById("regForm"); if (form.user.value == "") { alert("用户名不能为空!"); } else { form.submit(); } } </script> <form method=post id="regForm" action="jsp1.jsp"> 用户<input type="text" name="user" onkeydown="if(event.keyCode==13) return false;"/>
    <INPUT TYPE="button" onclick="check();" id="regBut" value="提交"/> </form> 或者用下面的例子,里面用了onSubmit,只要提交,它就会被执行。

    03

    xplanner-0.7b7b 部署问题解决

    ERROR – alina].[localhost].[/xplanner] – Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘metaRepository’ defined in class path resource [spring-beans.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.apache.commons.collections.map.LinkedMap] to required type [java.util.HashMap] for property ‘repositories’] PropertyAccessExceptionsException (1 errors) org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.apache.commons.collections.map.LinkedMap] to required type [java.util.HashMap] for property ‘repositories’ at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:839) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:584) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:469)

    02

    扫码

    添加站长 进交流群

    领取专属 10元无门槛券

    手把手带您无忧上云

    扫码加入开发者社群

    相关资讯

    热门标签

    活动推荐

      运营活动

      活动名称
      广告关闭
      领券