zoukankan      html  css  js  c++  java
  • 处理ASP中checkbox 在 form enctype="multipart/formdata"中只能取一个的问题

    借助JS

     function recheck(form)

    {

         var temp=document.getElementById("categories");
      temp.value=(temp.value.substring(0,1)==",")?temp.value.substring(1,temp.value.length):temp.value;
      return true;

    }

     function ck(o)
     {
      var v=o.value;
      var temp=document.getElementById("categories");
      temp.value=(o.checked)?temp.value+","+v:temp.value.replace(","+v,"");
     }

    <FORM   method="post" enctype="multipart/form-data" name="form1" onSubmit="return recheck(this)">

    <input type="hidden" name="categories" id="categories" />

    <input type="checkbox" name="category" id="category" value="1"  onclick="ck(this)"/>

    <input type="checkbox" name="category" id="category" value="2" onclick="ck(this)"/>  

    <input type="checkbox" name="category" id="category" value="3" onclick="ck(this)"/>

    </form>

     这种仅在数据量比较小的情况,因为hidden的长度是有限制的

  • 相关阅读:
    linux网桥浅析
    linux slub分配器浅析
    vs2015 C# WinForm 使用皮肤 美化窗体
    枚举可以直接赋值给int
    LINK : fatal error LNK1000: Internal error during IncrBuildImage
    map映射类
    map
    time
    int to string
    eclipse
  • 原文地址:https://www.cnblogs.com/hubj/p/1318799.html
Copyright © 2011-2022 走看看