zoukankan      html  css  js  c++  java
  • jQuery 取值操作

    • 模板使用:

      https://startbootstrap.com/themes/sb-admin-2/
      使用的 bootstrap 模块 ,上面的这个网站可以下载

    • select 取值

      <select class="com1_bandrate" id="com1_bandrate"  name=""  onchange="show_com1()">   
      <option   value="2400">2400</option>   
      <option   value="115200">115200</option>   
      <option   value="460800">460800</option>   
       </select>
      
      <script type="text/javascript">
      function show_com1(){
      	console.log(($("#com1_bandrate").find("option:selected").val()));
      }
      function show_com2(){
      	console.log(($("#com2_bandrate").find("option:selected").val()));
      }
      
      </script>
      

      select 取值,可以直接使用 $("#id").find("option.selected").val() 进行取值。

    • text 取值

          <input type="text" class="mb-4 form-control form-control-user" id="eth0_ip" placeholder="IP">
          <input type="text" class="mb-4 form-control form-control-user" id="eth0_gateway" placeholder="Gateway">
          <input type="text" class="mb-4 form-control form-control-user" id="eth0_netmask" placeholder="netmask">
           <input type="text" class="mb-4 form-control form-control-user" id="eth0_dns" placeholder="DNS">
      
          <script type="text/javascript">
      function save_func(){
      	console.log(($("#eth0_ip").val()))
      	console.log(($("#eth0_netmask").val()))
      	console.log(($("#eth0_gateway").val()))
      	console.log(($("#eth0_dns").val()))
      
      	console.log(($("#eth1_ip").val()))
      	console.log(($("#eth1_netmask").val()))
      	console.log(($("#eth1_gateway").val()))
      	console.log(($("#eth1_dns").val()))
      }
      
      function eth0_mode(){
      	console.log(($("#eth0_mode_id").find("option:selected").val()));
      	var eth_mode = $("#eth0_mode_id").find("option:selected").val();
      	if (eth_mode == "static")
      	{
      		$("#eth0_ip").removeAttr("readonly");
      		$("#eth0_netmask").removeAttr("readonly");
      		$("#eth0_gateway").removeAttr("readonly");
      		$("#eth0_dns").removeAttr("readonly");
      	}
      	else
      	{
      		$("#eth0_ip").attr("readonly", "readonly");
      		$("#eth0_netmask").attr("readonly", "readonly");
      		$("#eth0_gateway").attr("readonly", "readonly");
      		$("#eth0_dns").attr("readonly", "readonly");
      	}
      }
      function eth1_mode(){
      	console.log(($("#eth1_mode_id").find("option:selected").val()));
      	var eth_mode = $("#eth1_mode_id").find("option:selected").val();
      	if (eth_mode == "static")
      	{
      		$("#eth1_ip").removeAttr("readonly");
      		$("#eth1_netmask").removeAttr("readonly");
      		$("#eth1_gateway").removeAttr("readonly");
      		$("#eth1_dns").removeAttr("readonly");
      	}
      	else
      	{
      		$("#eth1_ip").attr("readonly", "readonly");
      		$("#eth1_netmask").attr("readonly", "readonly");
      		$("#eth1_gateway").attr("readonly", "readonly");
      		$("#eth1_dns").attr("readonly", "readonly");
      	}
      
      
      }
      
      </script>
      
      
  • 相关阅读:
    [转]ThinkPHP中如何使用原生SQL
    php定时回调接口
    [转]mysql dual虚拟表
    [转]mysql变量使用总结
    [转]使用mysql profiles 来查看sql 语句执行计划
    [转]Mysql中的SQL优化与执行计划
    [转]MySQL单列索引和组合索引的区别介绍
    前端开发框架
    sugar crm
    [转]MCC(移动国家码)和 MNC(移动网络码)
  • 原文地址:https://www.cnblogs.com/chenfulin5/p/11943038.html
Copyright © 2011-2022 走看看