我对跨浏览器兼容性有疑问。
我想在下面的代码中使用event.target
而不是event.srcElement
使它适用于 Firefox。
我用过target = event.target || event.srcElement
。它不工作。任何帮助将不胜感激。
function jumptoPopupMenuItem(theMenuID)
{
if (event.srcElement.className == "RightClickMenuItems")
{
if (event.srcElement.getAttribute("url") != null)
{
var strParameters = "";
if (theMenuID == "mnuAppointmentMenu")
{
strParameters = "AppointmentNumber=" + m_strAppointmentTypeYearNumber;
}
else if (theMenuID == "mnuAvailableHourMenu")
{
strParameters = "PreFillLanguageID=" + m_nLanguageID;
strParameters = strParameters + "&PreFillInterpreterID=" + m_nInterpreterID;
strParameters = strParameters + "&PreFillDateOfService=" + m_dtDateOfService;
}
if (event.srcElement.getAttribute("target") != null)
{
var PopupWindow = window.open(
event.srcElement.url + strParameters,
event.srcElement.getAttribute("target"));
PopupWindow.focus();
}
else
{
window.location = event.srcElement.url;
}
}
hidePopupMenu(theMenuID);
}
}