<html>
<head>
<title></title>
<script type="text/javascript">
function checkForm(){
var name=document.form1.number.value; //or form1.number.value
var name=document.forms[0].number.value;
var name=document.forms[0]['number'].value;
var name=document.form1['number'].value //or form1['number'].value
alert(name);

}
</script>
</head>
<body>
<form name="form1" method="post" action="">
网元名称:<input type="text" name="number" size="20">
<br>
<input type="submit" value="提交" onClick="checkForm()">
</form>
</body>
</html>

获取form表单元素值的4种方式的更多相关文章

  1. 5 获取Form表单取值

    #form表达提交@app.route("/data",methods=['GET','POST']) #methods 让当前路由支持GET 和 POST 方式def data( ...

  2. 浏览器原生 form 表单POST 数据的两种方式

    我们在提交表单的时候,form表单参数中会有一个enctype的参数.enctype指定了HTTP请求的Content-Type. 常用有两种:application/x-www-form-urlen ...

  3. Form表单提交数据的几种方式

    一.submit提交 在form标签中添加Action(提交的地址)和method(post),且有一个submit按钮(<input type='submit'>)就可以进行数据的提交, ...

  4. JS获取form表单所有属性值

    // 得到一个表单里的全部信息function getFormQueryString() { var frmID=document.forms[0]; var i,queryString=" ...

  5. 如何用jquery获取form表单的值

    $(function(){ $('.btn').click(function(){ alert($('#form').serialize()); }) }) 这样就获取到了 #form的值.

  6. 微信小程序--获取form表单初始值提交数据

    <form bindsubmit="formSubmit"> <view class="txt"> <view class=&qu ...

  7. form 表单提交的另一种方式 js

    <html> <head> <script type="text/javascript"> function formSubmit() { fm ...

  8. jQuery操作Form表单元素

    Web开发中常常须要操作表单,form表单元素有select.checkbox.radio.textarea.button.file.text.hidden.password等. 当中checkbox ...

  9. jQuery name属性与checked属性结合获取表单元素值

    var paytype = $("input[name='paytype']:checked").val(); alert(paytype); input元素下名称为paytype ...

随机推荐

  1. day8:vcp考试

    Q141. An administrator is unable to upgrade a vCenter Server Appliance from version 5.1 Update 2 to ...

  2. jquery 赋值时不触发change事件解决

    $("#optionsId").change(function(){ $("#selectOptionsText").val('测试'); }); $(&quo ...

  3. linux 下 php 安装 pthreads

    1.下载pthreads的源码包 https://pecl.php.net/package/pthreads 如:pthreads-3.1.6.tgz 2.解压 > tar zxvf pthre ...

  4. Linq select 语法

    文档:https://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b 1.可以对查询出来的结果做一些转换,下面的例子在数组中查找以"B&q ...

  5. 网页flash播放代码

    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" hei ...

  6. DB2中的数据类型

    DB2中的数据类型DB2内置数据类型可以分成数值型(numeric).字符串型(character string).图形字符串(graphic string).二进制字符串型(binary strin ...

  7. Boolean.getBoolean用法

    相信很多人被Boolean.getBoolean(String name)欺骗过,想当然的认为它是将"true"或者"false"转换为Boolean类型的AP ...

  8. HDOJ1242 Rescue(营救) 搜索

    Rescue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  9. 2018年上半年UI领域主要的13个设计趋势

    2018年时间过半,通过过去的6个月的观察,其实我们已经可以对于2018年的整个UI领域的设计趋势有了一个更为清晰的判断. 也是推出这篇文章比较合理的时机.下面我们就一起来回顾一下,过去的半年当中,U ...

  10. plupload.Uploader多文件上传

    .前台 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CommonUpfi ...