开发者

How to skip the method if the event is generated from specified button?

This is in continuation of

How to attach an event to onSubmit event of 开发者_Python百科form with chaining earlier attached methods as well?

Now, I am having disablePage method which will be executed every time there is any submit event occurs, but I don't want this method to execute if the event is generated from export button.

<input type="submit" name="_export" id="btnExportID"  />

How can I handle this?


quick-n-dirty: declare a variable var exportClicked set it on click of _export button. in disablePage check if the source is _export and pass it.

function disablePage(){
    if(exportClicked){
        exportClicked=false;
        return;
    }

   //block page...
}

.

<input type="submit" name="_export" id="btnExportID" 
       onclick="exportClick();" />

function exportClick(){
    exportClicked = true;
    document.getElementsByTagName('Form')[0].submit();
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜