jquerydisable掉下拉框和查找div标签下的下拉框和文本框的方法

jackxiang 2010-4-7 11:32 | |


selectinputdisable.html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>安踏--我爱CBA积分乐FUN天--首页</title>

<link rel="stylesheet" href="demo.css" />
<script type='text/javascript' src="/2010cba/jc/js/jquery/jquery.js"></script>
<script type="text/javascript">
  $().ready(
      
    function(){
            data = {"code":"0","message":"OK","point":"7,8,9","answer":"1,1,1","mypoint":"200,100,200"} ;
            var list=data.point.split(',');              
            var counter=0;
            for(var i=0;i<list.length;i++){
                if($('#point_item_'+list[i]).size()>0)counter++;
                $('#point_item_'+list[i]).find('input,select').attr('disabled',true);
                $('#point_item_'+list[i]).attr('title','此题已经竞猜')
                $('#point_item_'+list[i]).find('.question_span').css({'color':'gray'});
      }
    }
  );

</script>
<body>
<div class="point_list" id="point_list"><!--#include file='./guess2.html'--> </div>
</body>



include的文件,注意编号:point_item_Number:


<input name="FSubjectNumber" type="hidden" value="2" />
<div class="point_item" id="point_item_7">
  <input name="FSubjectId" type="hidden" value="7" />
  <span class="question_span">7.哪两支队伍将进入总冠军争夺战?</span>
  <select name="FSubjectAnswer" class="select_answer" id="FSubjectAnswer">
    <option value="1">广东、新疆</option>
    <option value="2">广东、上海</option>
    <option value="3">广东、广厦</option>
    <option value="4">新疆、上海</option>
    <option value="5">新疆、广厦</option>
    <option value="6">广厦、上海</option>
  </select>
  <!--<input name="FLowestScore"  class="select_note_num" value="100"/>-->
  <select name="FLowestScore" id="FLowestScore">
    <option value="0" selected="selected">0</option>
    <option value="1500">100</option>
    <option value="200">200</option>
    <option value="300">300</option>
    <option value="400">400</option>
    <option value="500">500</option>
    <option value="600">600</option>
    <option value="700">700</option>
    <option value="800">800</option>
    <option value="900">900</option>
    <option value="1000">1000</option>
    <option value="1100">1100</option>
    <option value="1200">1200</option>
    <option value="1300">1300</option>
    <option value="1400">1400</option>
    <option value="1500">1500</option>
  </select>
  <input  name="odds" readonly="readonly" type="text" class="input_odds" value="1:20" disabled="disabled"/>
</div>
<div class="point_item" id="point_item_8">
  <input name="FSubjectId" type="hidden" value="8" />
  <span class="question_span">8.哪支球队将会率先出线进入总决赛?</span>
  <select name="FSubjectAnswer" class="select_answer" id="FSubjectAnswer">
    <option value="1">广东</option>
    <option value="2">新疆</option>
    <option value="3">广夏</option>
    <option value="4">上海</option>
  </select>
  <!--<input name="FLowestScore"  class="select_note_num" value="100"/>-->
  <select name="FLowestScore" id="FLowestScore">
    <option value="0" selected="selected">0</option>
    <option value="100">100</option>
    <option value="200">200</option>
    <option value="300">300</option>
    <option value="400">400</option>
    <option value="500">500</option>
    <option value="600">600</option>
    <option value="700">700</option>
    <option value="800">800</option>
    <option value="900">900</option>
    <option value="1000">1000</option>
    <option value="1100">1100</option>
    <option value="1200">1200</option>
    <option value="1300">1300</option>
    <option value="1400">1400</option>
    <option value="1500">1500</option>
  </select>
  <input  name="odds" readonly="readonly"  type="text" class="input_odds" value="1:10" disabled="disabled" />
</div>
<div class="point_item" id="point_item_9">
  <input name="FSubjectId" type="hidden" value="9" />
  <span class="question_span">9.广东VS上海,此场比赛谁将获胜?</span>
  <select name="FSubjectAnswer" class="select_answer" id="FSubjectAnswer">
    <option value="1">广东</option>
    <option value="2">上海</option>
  </select>
  <!--<input name="FLowestScore"  class="select_note_num" value="200"/>-->
  <select name="FLowestScore" id="FLowestScore">
    <option value="0" selected="selected">0</option>
    <option value="200">200</option>
    <option value="300">300</option>
    <option value="400">400</option>
    <option value="500">500</option>
    <option value="600">600</option>
    <option value="700">700</option>
    <option value="800">800</option>
    <option value="900">900</option>
    <option value="1000">1000</option>
  </select>
  <input  name="odds" readonly="readonly" type="text" class="input_odds" value="1:8" disabled="disabled" />
</div>
<div class="point_item" id="point_item_10">
  <input name="FSubjectId" type="hidden" value="10" />
  <span class="question_span">10.广东VS上海,第一个进球的队伍会是?</span>
  <select name="FSubjectAnswer" class="select_answer" id="FSubjectAnswer">
    <option value="1">广东</option>
    <option value="2">上海</option>
  </select>
  <!--<input name="FLowestScore"  class="select_note_num" value="200"/>-->
  <select name="FLowestScore" id="FLowestScore">
    <option value="0" selected="selected">0</option>
    <option value="200">200</option>
    <option value="300">300</option>
    <option value="400">400</option>
    <option value="500">500</option>
    <option value="600">600</option>
    <option value="700">700</option>
    <option value="800">800</option>
    <option value="900">900</option>
    <option value="1000">1000</option>
</select>
  <input  name="odds" readonly="readonly"  type="text" class="input_odds" value="1:8" disabled="disabled" />
</div>
<div class="point_item" id="point_item_11">
  <input name="FSubjectId" type="hidden" value="11" />
  <span class="question_span">11.广东VS上海,最后一个进球会是几分球?</span>
  <select name="FSubjectAnswer" class="select_answer" id="FSubjectAnswer">
    <option value="1">1分球</option>
    <option value="2">2分球</option>
    <option value="3">3分球</option>
  </select>
  <!--<input name="FLowestScore"  class="select_note_num" value="100"/>-->
  <select name="FLowestScore" id="FLowestScore">
    <option value="0" selected="selected">0</option>
    <option value="200">200</option>
    <option value="300">300</option>
    <option value="400">400</option>
    <option value="500">500</option>
    <option value="600">600</option>
    <option value="700">700</option>
    <option value="800">800</option>
    <option value="900">900</option>
    <option value="1000">1000</option>
  </select>
  <input  name="odds" readonly="readonly"  type="text" class="input_odds" value="1:8" disabled="disabled" />
</div>
<div class="point_item" id="point_item_12">
  <input name="FSubjectId" type="hidden" value="12" />
  <span class="question_span">12. 广东VS上海, 全场单人最高得分会是多少?</span>
  <select name="FSubjectAnswer" class="select_answer" id="FSubjectAnswer">
    <option value="1">0-20</option>
    <option value="2">21-23</option>
    <option value="3">24-26</option>
    <option value="4">27-29</option>
    <option value="5">30-32</option>
    <option value="6">33-35</option>
    <option value="7">36-38</option>
    <option value="8">39-41</option>
    <option value="9">42-45</option>
    <option value="10">45以上</option>
  </select>
  <!--<input name="FLowestScore"  class="select_note_num" value="200"/>-->
  <select name="FLowestScore" id="FLowestScore">
<option value="0" selected="selected">0</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="600">600</option>
<option value="700">700</option>
<option value="800">800</option>
<option value="900">900</option>
<option value="1000">1000</option>
<option value="1100">1100</option>
<option value="1200">1200</option>
<option value="1300">1300</option>
<option value="1400">1400</option>
<option value="1500">1500</option>
    <option value="1600">1600</option>
    <option value="1700">1700</option>
    <option value="1800">1800</option>
    <option value="1900">1900</option>
    <option value="2000">2000</option>    
  </select>
  <input  name="odds" readonly="readonly" type="text" class="input_odds" value="1:30" disabled="disabled" />
</div>
<div class="point_submit">
    <input type="image" src="/2010cba/jc/images/but_submit.png" />
</div>




前面的那个json输出的data,是通过C++格式化后输出的:

如下:

void MakeJSON(string code,string msg,string point,string result,string mypoint){
  cout<< "{\"code\":\""+code+"\",\"message\":\""+msg+"\",\"point\":\""+point+"\",\"answer\":\""+result+"\",\"mypoint\":\""+mypoint+"\"}"<<endl;
}





     string resultJSON="";
     string resultJSONA="";
     string resultJSONB="";
    CMyFileDB FileDB(dbconn_cba_jc.getConnector());
    FileDB.MakeDB("DB_ANTA_2010CBA_JC");
    FileDB.MakeTable("Tbl_File");
    MyFile stGuessDetail;
    stGuessDetail.init();//每次循环init清空一次
    stGuessDetail.strQQ = CCommonTool::itoa(iRet);          //QQ号码
    if(FileDB.QueryFileList(stAntaCbaGuessList,stGuessDetail)<0){
      MakeJSON("-1","FAILE",resultJSON,resultJSONA,resultJSONB);
      return -1;  
    }
    int iGuessSize=stAntaCbaGuessList.size();
    if(iGuessSize==0){
      MakeJSON("-1","FAILE",resultJSON,resultJSONA,resultJSONB);
      return -2;  
    }
    
    for(int i=0;i<iGuessSize;i++){
      if(i==0){
        resultJSON=CCommonTool::itoa(stAntaCbaGuessList[i].iVoteCount);
        resultJSONA=CCommonTool::itoa(stAntaCbaGuessList[i].iScore);
        resultJSONB=CCommonTool::itoa(stAntaCbaGuessList[i].iViewCount);
      }else{
        resultJSON+=","+CCommonTool::itoa(stAntaCbaGuessList[i].iVoteCount);
        resultJSONA+=","+CCommonTool::itoa(stAntaCbaGuessList[i].iScore);
        resultJSONB+=","+CCommonTool::itoa(stAntaCbaGuessList[i].iViewCount);
      }
    }
  MakeJSON("0","OK",resultJSON,resultJSONA,resultJSONB);
    
    return 0;

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/2898/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2010-4-7 11:39
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]