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

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

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

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

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

//模板下拉框發(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ā)出請求,返回一個字符串,把改字符串分開成字符串?dāng)?shù)組,接下來遍歷標(biāo)簽<div class="indexStatistics">下面的標(biāo)簽,遇到相關(guān)的標(biāo)簽,則打鉤(true)。indexStatisticsAction_getSelect.jsp的相關(guān)代碼如下:
復(fù)制代碼 代碼如下:

//獲取模板對應(yīng)的指標(biāo)
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();
}

相關(guān)文章

最新評論

专栏| 高阳县| 五家渠市| 蒙山县| 沾益县| 皋兰县| 清镇市| 黄石市| 绍兴市| 伊通| 南充市| 汤阴县| 神池县| 麻栗坡县| 舞阳县| 连云港市| 泽库县| 奉新县| 元氏县| 龙里县| 永丰县| 两当县| 宝丰县| 青海省| 盐亭县| 房山区| 济源市| 涟水县| 南雄市| 乌鲁木齐县| 丹阳市| 城口县| 新疆| 若羌县| 新建县| 东安县| 牟定县| 宜兰市| 张家口市| 长兴县| 海阳市|