Defining JavaScript Event Object

后端 未结 4 1968
鱼传尺愫
鱼传尺愫 2021-01-15 12:24

Why am I getting an error for this piece of code?:

function catchevent() 
{
    eventSrcID=(event.srcElement)?event.srcElement.id:\'undefined\';

    eventty         


        
4条回答
  •  孤街浪徒
    2021-01-15 12:35

    In Firefox, the first param passed to a handler is the event. So a cross browser piece of code would check for a param and use it if present. If not present, it would default to window.event, the IE way.

提交回复
热议问题