zoukankan      html  css  js  c++  java
  • 后台得到HTML控件值

     第一种方法:

    前台

    <div>
            <select id="Select1" name="sel">
                <option selected="selected" value="1">1</option>
                 <option selected="selected" value="2">2</option>
                  <option selected="selected" value="3">3</option>
                   <option selected="selected" value="4">4</option>
                   <option selected="selected" value="5">5</option>
                   <option selected="selected" value="6">6</option>
            </select>
            <input id="Text1" type="text" name="Text1"/>       
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>

    后台

      Response.Write(Request.Form["sel"].ToString()+"<br>");
            Response.Write(Request.Form["Text1"].ToString());

    第二种方法:  ajaxpro

    前台

    function Addint()
         {
           var tb1=document.getElementById('TextBox1').value;
           var tb2=document.getElementById('TextBox2').value;
           document.getElementById('TextBox3').value = ajaxSum.AddTwo(tb1,tb2).value;
         }

    后台

     [AjaxPro.AjaxMethod]
        public string AddTwo(int firstInt, int secondInt)
        {
            return Convert.ToString(firstInt+secondInt);
        }

  • 相关阅读:
    2014第8周二杂记
    2014第8周一JS正则小问题
    2014第7周日最强大脑
    2014第7周六杂记
    2014第7周五杂记
    2014第7周四excel多列文本复制技巧
    2014第7周三初识CouchBase
    2014第7周二需求
    2014第7周1Web安全概念学习
    shell程序之逐行读取一文件里的參数且使用此參数每次运行5分钟
  • 原文地址:https://www.cnblogs.com/freexiaoyu/p/1378311.html
Copyright © 2011-2022 走看看