最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery自動填充勾選框即把勾選框打上true

 更新時間:2014年03月24日 17:10:00   作者:  
jquery自動填充勾選框,即把勾選框打上(true),然后通過ajax方式獲得勾選項列表,再把列表內的選項打上
jquery自動填充勾選框,即把勾選框打上(true),然后通過ajax方式獲得勾選項列表,再把列表內的選項打上。
復制代碼 代碼如下:

下拉框<select name="makemodule" id="makemodule" style='width:130px' onchange='makemoduleSelected()'>
<option value='1'>1</option>
</select>

select改變,觸發(fā)函數(shù)makemoduleSelected(),該函數(shù)如下:
復制代碼 代碼如下:

//模板下拉框發(fā)生變化時,觸發(fā)此事件(onchange)。
function makemoduleSelected(){
clearAll('property');
var modtitlecode = $("#makemodule").val();
$.ajax({
url : 'indexStatisticsAction_getSelect.jsp',
data: { page:'clientindexStatistics.jsp',method:'get_subname_en',modtitlecode:modtitlecode},
success : function(result){
// 根據(jù)result返回信息判斷是否登錄成功
var results = result.split(",");
//document.getElementById(results[i]).checked = true;
$(".indexStatistics").each(function(){
$(this).find("input").each(function(){
var tempVal = $(this).val();
for(var i=0; i<results.length; i++){
if(tempVal == results[i]) $(this).attr("checked", true);
}
});
});
}
});
}

該函數(shù)通過ajax方式向indexStatisticsAction_getSelect.jsp發(fā)出請求,返回一個字符串,把改字符串分開成字符串數(shù)組,接下來遍歷標簽<div class="indexStatistics">下面的標簽,遇到相關的標簽,則打鉤(true)。indexStatisticsAction_getSelect.jsp的相關代碼如下:
復制代碼 代碼如下:

//獲取模板對應的指標
if(method.equals("get_subname_en")){
String modtitlecode = request.getParameter("modtitlecode");
if(modtitlecode.equals("-------")) return;
String sql = sql2.replace("?modtitlecode?",modtitlecode);
sql = sql.replace("?userId?",userId);
System.out.println(sql);
StringBuffer subnames = new StringBuffer();
Db db = new Db();
try {
db.prepareQuery();
ResultSet rs = db.executeQuery(sql);
while (rs!=null && rs.next()) {
subnames.append(rs.getString("subname_en"));
subnames.append(",");
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
db.endQuery();
}
PrintWriter pout = response.getWriter();
pout.write(subnames.toString().substring(0,subnames.length()-1));
pout.flush();
pout.close();
}

相關文章

最新評論

红安县| 明星| 谢通门县| 平原县| 荔波县| 冷水江市| 武汉市| 铅山县| 巢湖市| 长武县| 永济市| 东港市| 茌平县| 洪洞县| 徐水县| 石楼县| 西安市| 旬阳县| 大悟县| 红安县| 霍州市| 普陀区| 泸州市| 行唐县| 江门市| 庆安县| 潼南县| 玉环县| 罗田县| 潞城市| 龙里县| 吉安县| 凌海市| 全州县| 刚察县| 安龙县| 巢湖市| 神木县| 墨竹工卡县| 翁源县| 临沭县|