开发者

how to pause the execution of a href in prototype after clicking on the link

I am in a very tricky position where i have to fix a very old code. the scenario is i have a page where i have many text boxes for comments and there are links on the right side of the page which redirect the user to new pages. IF user enters some comments and clicks the link ( which are href), the comments should be save automatically.

This is working in IE and Mozilla, but not in safari. The code is developed using prototype JS framework and Ajax with PERL.

Initially i used

self.autosaver = function () {
        self._save(); 
    };
Event.observe( window, 'unload', self.开发者_JS百科autosaver ); # doesn't work in Safari

so i wrote a small snippet,

Event.observe(document.body, 'click', function(event) {
    var element = Event.element(event);
    if ('A' == element.tagName) //checking if it is a anchor
        self._save();
      //element.hide(); 
     // hide works in all the browser but saving operation is not working in Safari.
     //I did this just for testing          

});

But still, i am not able to achieve the desired result. Can any one please help me out. Thanks in advance


http://www.prototypejs.org/discuss

post it to the mailing list here.

Also I would suggest you to see this

http://ajaxian.com/archives/prototype-upgrade-for-safari

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜