selObj.fireEvent 不是函数
selObj.fireEvent is not a function
我们在 js 文件上有这个功能,当用户点击父项目时拉出菜单树:
function menusel(unid)
{
//if its in the array, deactivate it and take it out
var index = inarray(unid,selectedarray);
//first arrange the array
if(index)
{
selectedarray[index] = 0;
}
else
{
//we have restrictions
if(treeRestrictMode==1)
{
//now check its not in the array of items not allowed to b picked
if(inarray(unid,nonSelArr))
{
alert('This Item is Unselectable');
return;
}
}
//if we are in unique tree mode, can only select one
if(treeSingleMode==1)
{
//check for a non zero value, and deselect it [recursively]#
for(var x=0;x<selectedarray.length;x++)
{
if(selectedarray[x]!=0)
{
//alert(unid+' '+selectedarray[x]);
menusel(selectedarray[x]);
}
}
}
selectedarray.push(unid);
}
sel_unselect(unid,index);
//if we have an override function, it means we will assume that the parent page
//as an input type function called treeSelFunc which takes the id and takes care of the rest
if(overrideFunction!='')
{
parent.parent.treeSelFunc(unid,selName);
return;
}
if(treeSingleMode!=1)
{
var selObj = emptySel(0);//set txt will fill it for us
}
else
{
var selObj = parent.parent.MM_findObj(selName);
//see if we have options..will need to empty them
if(selObj.size>1)
{
emptySel(1);
}
else
{
selObj.value=0;
}
}
setTxt(selObj);
selObj.fireEvent('onchange');
}
我们在页面上这样称呼它:
<a id="troot[VMENU]_040" onclick="menusel(40);" class="sel">All</a>
我们得到了这个:
未捕获类型错误:selObj.fireEvent 不是函数
它曾经在较旧的浏览器版本上工作(我想是在 explorer 8 上),但现在不能再使用 Chrome。有什么想法吗?
fireEvent 方法是标准 EventTarget.dispatchEvent() 方法的专有 Microsoft Internet Explorer 替代方法。
改为使用 dispatchEvent 方法。
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
我们在 js 文件上有这个功能,当用户点击父项目时拉出菜单树:
function menusel(unid)
{
//if its in the array, deactivate it and take it out
var index = inarray(unid,selectedarray);
//first arrange the array
if(index)
{
selectedarray[index] = 0;
}
else
{
//we have restrictions
if(treeRestrictMode==1)
{
//now check its not in the array of items not allowed to b picked
if(inarray(unid,nonSelArr))
{
alert('This Item is Unselectable');
return;
}
}
//if we are in unique tree mode, can only select one
if(treeSingleMode==1)
{
//check for a non zero value, and deselect it [recursively]#
for(var x=0;x<selectedarray.length;x++)
{
if(selectedarray[x]!=0)
{
//alert(unid+' '+selectedarray[x]);
menusel(selectedarray[x]);
}
}
}
selectedarray.push(unid);
}
sel_unselect(unid,index);
//if we have an override function, it means we will assume that the parent page
//as an input type function called treeSelFunc which takes the id and takes care of the rest
if(overrideFunction!='')
{
parent.parent.treeSelFunc(unid,selName);
return;
}
if(treeSingleMode!=1)
{
var selObj = emptySel(0);//set txt will fill it for us
}
else
{
var selObj = parent.parent.MM_findObj(selName);
//see if we have options..will need to empty them
if(selObj.size>1)
{
emptySel(1);
}
else
{
selObj.value=0;
}
}
setTxt(selObj);
selObj.fireEvent('onchange');
}
我们在页面上这样称呼它:
<a id="troot[VMENU]_040" onclick="menusel(40);" class="sel">All</a>
我们得到了这个: 未捕获类型错误:selObj.fireEvent 不是函数
它曾经在较旧的浏览器版本上工作(我想是在 explorer 8 上),但现在不能再使用 Chrome。有什么想法吗?
fireEvent 方法是标准 EventTarget.dispatchEvent() 方法的专有 Microsoft Internet Explorer 替代方法。
改为使用 dispatchEvent 方法。
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent