开发者

Javascript how can I trigger an event that was prevented

开发者 https://www.devze.com 2022-12-28 14:45 出处:网络
In my app a user clicks a link to another page. I\'d like to track that in Omniture with a custom event, so I\'ve bound the omniture s.t() event to the click event. How can I make certain the event fi

In my app a user clicks a link to another page. I'd like to track that in Omniture with a custom event, so I've bound the omniture s.t() event to the click event. How can I make certain the event fires before the next page is requested?

I've considered event.preventDefault() on the click开发者_如何学JAVA event of the link, but I actually want the original event to occur, just not immediately.


omniture's s.tl() function has a built-in delay


Some thing like this:

var cachedEvent = yourElement.onclick;
yourElement.onclick = function(){

    s.t(); // Omniture thingy
    cachedEvent(); // Old event

}


I don't know what Omniture events are, but just have

yourElement.onClick = function(){
    omnitureFunction();
}

onmitureFunction = function() {
    //stuff
    myOtherFunction();//what onClick is "supposed to do"
}

So function2 happens only on successful completion of function1

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号