当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 下面是我的实现代码,可是返回值为空 ansistring __fastcall tipscan::getname(ansistring host) { ansistring text; int ireturn=socketinitialize(); if(ireturn==0) text=resolveip(host); socketclose(); return text; } int ......
 ·关于pagefile.sys    »显示摘要«
    摘要: 可否修改它的大小?修改后会有什么后果? ......


多选列表 不管其中的选项是不是被selected 提交的时候所有的选项都被提交

就是无论用户点没点这个多选列表   提交给服务器后   都是把所有选项的value都穿过来了    
   
  有什么解决办法么   ?

NO.1   作者: bruce_figo

在表单里加入一个hidden,当用户提交时,你把selected中所有的option的值都以字符串形式写入  
  hidden,当然,你要用特殊的字符将值分开,然后在服务器上读hidden的值,再把每个值根据你的  
  分隔符取出来

NO.2   作者: annkie

使用框架  
  for(i=0;i<parent.f1.form1.select1.options.length;i++)  
  parent.f2.form1.select1.options[i].value=parent.f1.form1.select1.options[i].value;

NO.3   作者: annkie

我没asp环境,写个大概给你吧.  
  f1:main   frame  
  f2:width为0的框架,用来保存你的数据.  
  生成页面的时候你把select里面的数据保存到f2中,提交后到本页(f1),这样就可以通过框架访问到f2的数据了,格式如上.

NO.4   作者: hchxxzx

<html>  
  <head>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <title>无标题文档</title>  
  </head>  
   
  <body>  
  <form   name="form1"   method="post"   action="run_bc.asp"   onsubmit="return   check_frm()">  
      <p>  
          <select   name="selt1"   size="6"   multiple>  
              <option   value="1">测试文字处理1</option>  
              <option   value="2">测试文字处理2</option>  
              <option   value="3">测试文字处理3</option>  
              <option   value="4">测试文字处理4</option>  
              <option   value="5">测试文字处理5</option>  
              <option   value="6">测试文字处理6</option>  
          </select>  
      </p>  
      <p>    
          <input   name="bc"   type="submit"   id="bc"   value="提交">  
      </p>  
  </form>  
  </body>  
  </html>  
  <script   language=vbscript>  
  function   check_frm()  
  for   i=0   to   document.all("selt1").length-1  
  document.all("selt1")(i).selected=true  
  next  
  check_frm=false  
  //以上false改为true就可以了  
  end   function  
  </script>

NO.5   作者: net_lover

<form   name="form1"   method="post"   action="run_bc.asp"   onsubmit="return   check_frm()">  
      <p>  
          <select   id="selt2"   size="6"   multiple>  
              <option   value="1">测试文字处理1</option>  
              <option   value="2">测试文字处理2</option>  
              <option   value="3">测试文字处理3</option>  
              <option   value="4">测试文字处理4</option>  
              <option   value="5">测试文字处理5</option>  
              <option   value="6">测试文字处理6</option>  
          </select>  
          <input   type=hidden   name="selt1"   value="">  
      </p>  
      <p>    
          <input   name="bc"   type="submit"   id="bc"   value="提交">  
      </p>  
  </form>  
  </body>  
  </html>  
  <script>  
  function   check_frm()  
  {  
  l=document.getElementById("selt2")  
  for(i=0;i<l.options.length;i++)  
  document.getElementById("selt1").value+=l.options[i].value+","  
  document.getElementById("selt1").value   =   document.getElementById("selt1").value.substr(0,document.getElementById("selt1").value.length-1)  
  alert(document.getElementById("selt1").value)  
  }  
  </script>  
 


    摘要: 我就是一个。 不过经过了将近一个月的阴影,现在洒脱的走出来了。 另外想知道有多少是最近一个月分手的?我是情人节那天分的! 散分!! ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE