Reputation: 241
I have question about cross-browser compatibility.
I want to use the event.target
instead of event.srcElement
in the following code to make it work for firefox.
I have used target = event.target || event.srcElement
. It is not working. Any help will be appreciated.
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);
}
}
Upvotes: 1
Views: 4170
Reputation: 75666
if you're using jquery, just use var $target = $(e.target);
-- it'll do the right thing for the browsers.
Upvotes: 1