火狐对select里的onchange事件为何没有反映 25
这是select的代码str=drv[0]["nameRemark"].ToString()+"<selectid=\""+privilegeName+"\"onchan...
这是select的代码
str = drv[0]["nameRemark"].ToString() +
"<select id=\"" + privilegeName + "\"
onchange=\"changeValue(this.id,this.options[this.selectedIndex].value)\">";
function changeValue(id, val)
{
if (id=="canAuditContribute")
{
var itemAdd = document.getElementById("canAdd");
var itemDelete = document.getElementById("canDelete");
var itemRecommand = document.getElementById("canSetRecommand");
var itemTop = document.getElementById("canSetTop");
if(val=="1")
{
itemAdd.selectedIndex = 0;
TParams1[TParams["canAdd"]] = 0;
itemAdd.disabled = true;
itemDelete.selectedIndex = 0;
TParams1[TParams["canDelete"]] = 0;
itemDelete.disabled = true;
itemRecommand.selectedIndex = 1;
TParams1[TParams["canSetRecommand"]] = 1
itemRecommand.disabled = false;
itemTop.selectedIndex = 1;
TParams1[TParams["canSetTop"]] = 1
itemTop.disabled = false;
}
else if(val=="0")
{
itemRecommand.selectedIndex = 0;
TParams1[TParams["canSetRecommand"]] = 0;
itemRecommand.disabled = true;
itemTop.selectedIndex = 0;
TParams1[TParams["canSetTop"]] = 0;
itemTop.disabled = true;
itemAdd.selectedIndex = 1;
TParams1[TParams["canAdd"]] = 1
itemAdd.disabled = false;
itemDelete.selectedIndex = 1;
TParams1[TParams["canDelete"]] = 1
itemDelete.disabled = false;
}
}
TParams1[TParams[id]] = val;
}
但是下拉框不能修改 展开
str = drv[0]["nameRemark"].ToString() +
"<select id=\"" + privilegeName + "\"
onchange=\"changeValue(this.id,this.options[this.selectedIndex].value)\">";
function changeValue(id, val)
{
if (id=="canAuditContribute")
{
var itemAdd = document.getElementById("canAdd");
var itemDelete = document.getElementById("canDelete");
var itemRecommand = document.getElementById("canSetRecommand");
var itemTop = document.getElementById("canSetTop");
if(val=="1")
{
itemAdd.selectedIndex = 0;
TParams1[TParams["canAdd"]] = 0;
itemAdd.disabled = true;
itemDelete.selectedIndex = 0;
TParams1[TParams["canDelete"]] = 0;
itemDelete.disabled = true;
itemRecommand.selectedIndex = 1;
TParams1[TParams["canSetRecommand"]] = 1
itemRecommand.disabled = false;
itemTop.selectedIndex = 1;
TParams1[TParams["canSetTop"]] = 1
itemTop.disabled = false;
}
else if(val=="0")
{
itemRecommand.selectedIndex = 0;
TParams1[TParams["canSetRecommand"]] = 0;
itemRecommand.disabled = true;
itemTop.selectedIndex = 0;
TParams1[TParams["canSetTop"]] = 0;
itemTop.disabled = true;
itemAdd.selectedIndex = 1;
TParams1[TParams["canAdd"]] = 1
itemAdd.disabled = false;
itemDelete.selectedIndex = 1;
TParams1[TParams["canDelete"]] = 1
itemDelete.disabled = false;
}
}
TParams1[TParams[id]] = val;
}
但是下拉框不能修改 展开
1个回答
展开全部
尊敬的用户,您好!很高兴为您答疑。
首先,火狐对于onchange事件支持良好。
其次,您的dom对象书写很不严谨,通过浏览器的报错信息来看,您的对象根本无法正常获取,建议您更换个写法。
希望我的回答对您有所帮助,如有疑问,欢迎继续咨询我们。
首先,火狐对于onchange事件支持良好。
其次,您的dom对象书写很不严谨,通过浏览器的报错信息来看,您的对象根本无法正常获取,建议您更换个写法。
希望我的回答对您有所帮助,如有疑问,欢迎继续咨询我们。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询