jquery
//填数据
function ddlSmallType()
{alert('aaa');
$("#ddlSmallType").html("");
$("#ddlSmallType").append("<option value='0' selected='selected'>==请选择==</option>"); var strId=$("#ddlBigType option[selected]").attr("value"); if(strId!=0)
{
$.getJSON("ddlSmallType.aspx?Id="+strId, function (data) {
for (var i = 0; i < data.length; i++) {
$("#ddlSmallType").append($("<option></option>").val(data[i].ID).html(data[i].Cname));
};
});
}
// $("#ddlSmallType").focus();
}
$(document).ready(function(){
$("#ddlBigType").change(function () { ddlSmallType(); });//添加事件
$("#ddlSmallType").change(function () { document.getElementById("hdfSmallType").value=$("#ddlSmallType option[selected]").attr("value");});//添加事件
$("#ddlSmallType").val(0);$.formValidator.initConfig({formid:"form1",onerror:function(msg){alert(msg.replace(/<[^>]+>/g,""));return false;},onsuccess:function(){return true;}});$("#ddlBigType").formValidator({onshow:"<font color=\"999999\">请选择行业大类。</font>",onfocus:"所在行业大类必须选择",oncorrect:"谢谢你的配合"}).inputValidator({min:1,onerror: "你是不是忘记选择行业大类!"});
$("#ddlSmallType").formValidator({onshow:"<font color=\"999999\">请选择行业小类。</font>",onfocus:"所在行业小类必须选择",oncorrect:"谢谢你的配合"}).inputValidator({min:1,onerror: "你是不是忘记选择行业小类!"});});
存在 问题
select ddlSmallType中数据重复出现二次ddlSmallType 中 alert('aaa'); 执行二次与formValidator 冲突
动态$.getJSON 的数据时默认为select ddlSmallType中数据选择的是最后一条数据 入加上 $("#ddlSmallType").focus(); select ddlSmallType中数据重复出现二次
//填数据
function ddlSmallType()
{alert('aaa');
$("#ddlSmallType").html("");
$("#ddlSmallType").append("<option value='0' selected='selected'>==请选择==</option>"); var strId=$("#ddlBigType option[selected]").attr("value"); if(strId!=0)
{
$.getJSON("ddlSmallType.aspx?Id="+strId, function (data) {
for (var i = 0; i < data.length; i++) {
$("#ddlSmallType").append($("<option></option>").val(data[i].ID).html(data[i].Cname));
};
});
}
// $("#ddlSmallType").focus();
}
$(document).ready(function(){
$("#ddlBigType").change(function () { ddlSmallType(); });//添加事件
$("#ddlSmallType").change(function () { document.getElementById("hdfSmallType").value=$("#ddlSmallType option[selected]").attr("value");});//添加事件
$("#ddlSmallType").val(0);$.formValidator.initConfig({formid:"form1",onerror:function(msg){alert(msg.replace(/<[^>]+>/g,""));return false;},onsuccess:function(){return true;}});$("#ddlBigType").formValidator({onshow:"<font color=\"999999\">请选择行业大类。</font>",onfocus:"所在行业大类必须选择",oncorrect:"谢谢你的配合"}).inputValidator({min:1,onerror: "你是不是忘记选择行业大类!"});
$("#ddlSmallType").formValidator({onshow:"<font color=\"999999\">请选择行业小类。</font>",onfocus:"所在行业小类必须选择",oncorrect:"谢谢你的配合"}).inputValidator({min:1,onerror: "你是不是忘记选择行业小类!"});});
存在 问题
select ddlSmallType中数据重复出现二次ddlSmallType 中 alert('aaa'); 执行二次与formValidator 冲突
动态$.getJSON 的数据时默认为select ddlSmallType中数据选择的是最后一条数据 入加上 $("#ddlSmallType").focus(); select ddlSmallType中数据重复出现二次
解决方案 »
- 不吃饭在线等个jquery插件的fancybox 的应用问题,关闭图片后,页面上图片也消失了?
- 实现弹窗效果 js
- 图像js,移到图像上后,一指定SPAN处显示该图像
- javascript数组属性length的使用方法?
- 页面跳转过度页面问题.
- 请问用javascript如何打开一个在当前窗口的新页面
- 怎样让浏览器支持emf格式的图形文件
- 为什么运行时总说document.formname.hiddenName.length为未定义的?
- 这句话是什么意思啊
- 关于vs-code启动项目npm start报错。 急求
- 帮忙,改一段JS代码,和解释一下JS,高手请进!!!
- uncaught exception: [Exception... "Out of Memory" nsresult: "0x8007000e
alert('aaa');
var strId=$("#ddlBigType option[selected]").attr("value");
if(strId!=0){
$.getJSON("ddlSmallType.aspx?Id="+strId, function (data) {
$("#ddlSmallType").length=0;
$("#ddlSmallType").append("<option value='0' selected='selected'>==请选择==</option>");
for (var i = 0; i < data.length; i++) {
$("#ddlSmallType").append($("<option></option>").val(data[i].ID).html(data[i].Cname));
};
});
}
// $("#ddlSmallType").focus();
}
function ddlSmallType(){
alert('aaa');
var strId=$("#ddlBigType option[selected]").attr("value");
if(strId!=0){
$.getJSON("ddlSmallType.aspx?Id="+strId, function (data) {
$("#ddlSmallType").length=0;
$("#ddlSmallType").append("<option value='0' selected='selected'>==请选择==</option>");
for (var i = 0; i < data.length; i++) {
$("#ddlSmallType").append($("<option></option>").val(data[i].ID).html(data[i].Cname));
};
});
}
// $("#ddlSmallType").focus();
}
//$("#ddlBigType").formValidator({onshow:"<font color=\"999999\">请选择行业大类。</font>",onfocus:"所在行业大类必须选择只验证小类