IE8 JavaScript click event of onclick is not compatible with the solution

  • 2020-03-29 23:58:39
  • OfStack

Blog park flash page is generated with JavaScript, today found that under IE8 click page number can not turn the page, page turning operation is in the current page number of the onclick event.

Later changed to jQuery's attr method:

$(a).attr("onclick", this.ClickFunctionName + "(" + pageIndex + ");Pager.SetCurrent(" + pageIndex + ");");

The onclick event handler doesn't work no matter how you click it. Neither Chrome nor Firefox has this problem.

The problem was finally solved with the following code:

var js = this.ClickFunctionName + "(" + pageIndex + ");Pager.SetCurrent(" + pageIndex + ");";
a.onclick = function() { eval(js); }

Related articles: