zoukankan      html  css  js  c++  java
  • 怎样用js创建Form表单并提交

    var f = document.createElement("form");
    document.body.appendChild(f);
    var i = document.createElement("input");
    i.type = "hidden";
    f.appendChild(i);
    i.value = "5";
    i.name = "price";
    f.action = "aa.asp";
    f.submit();
    --------------------如何在两个html的网页间传递变量?--------
    <!--第一个页面-->
    <html>

    <head>
    <script>
    var key;
    function textcontent(x)
    {
    key=document.getElementById(x).value;
    location.href="test.htm?"+key;
    }
    </script>
    </head>

    <body>
    <input id=x value=""/>
    <input type=button value="跳转到test.htm页面" onclick="javascript:textcontent('x');">
    </body>

    </html>

    <!--第二个页面-->
    <html>
    <head>
    <title>text.htm页面</title>
    <script defer>
    var url=window.document.location.search;
    if(url!=null)
    {
    url=url.substring(1,url.length);
    }
    alert(url);
    </script>
    </head>
    <body>

    </body>
    </html>
    -------------怎么让用户不能输入"\"这个字符啊? ---------

    对像标签里加入:onKeyDown="if(window.event.keyCode==220){return false;};"
    如:<input type="text" name="textfield" onKeyDown="if(window.event.keyCode==220){return false;};">

    onKeyDown="alert(event.keyCode);"
    想知道哪个就按哪个

  • 相关阅读:
    fabric 网络操作中遇到的问题
    springBoot项目启动初始化数据
    行为验证码AJ-Captcha
    RestControllerAdvice注解无效问题
    记录美团一面问题
    关于springMVC
    作业08-集合
    选择排序
    Centos7 使用Minikube搭建Kubernetes集群
    Vscode 配置 Go语言插件
  • 原文地址:https://www.cnblogs.com/goody9807/p/885255.html
Copyright © 2011-2022 走看看