我的javascript代码适用于ie,chrome和safari但是它不适用于firefox。我检查了可能的解决方案,但没有工作。还是firefox说window.event undefined。
的Javascript
function OnChooseItem(type, id, src) {
window.event.cancelBubble = true;
if (selectedView == "TileView") {
if (selectedItem != void (0)) {
selectedItem.className = "ExplorerItem";
selectedItem._selected = false;
}
var event = src || window.event
selectedItem = (event.target || event.srcElement).value;
top.frames["OptionCallbackFrame"].MakeCallback(type, id);
while (selectedItem.parentPanel == void (0)) {
selectedItem = selectedItem.parentElement;
}
selectedItem._selected = true;
selectedItem.className = "ExplorerItemHover";
} else {
if (selectedItem != void (0)) {
selectedItem.className = selectedItem.__className;
}
selectedItem = src;
selectedItem.className = "DataGridItemMarked";
top.frames["OptionCallbackFrame"].MakeCallback(type, id);
}
服务器端
panel.Attributes.Add("onclick", "OnChooseItem(" + Numbers.GetSafeValue(dataReader["TYPE"]) + ", '" + Strings.GetSafeValue(dataReader["DOCUMENT_ID"]) + "', this)");
答案 0 :(得分:1)
尝试使用传递的参数获取事件:
var aVar = {
anExample: function(event){
var evnt = event || window.event
}
}