Adapt to the scene: if the mobile phone calls, you need to add an href attribute to the a tag, but because of the need to link jump to add the onclick event to a tag, if you do not do any processing, the default execution of the click event, without jumping the href attribute link.
How to fix: Override the href attribute and onclick event of a tag
This code can be placed in a click event
(function () {
This.fncancel (); var _event_list = {};//Find all the A tags on the page var links = document.getelementsbytagname ("a") [0];//Save the value of the Click Property var _click = Links.getattribute ("onclick");//Save the value of the href attribute var _href = links.getattribute ("href"), if (_click! = null) {//To ONCLI The CK property resets the value Links.setattribute ("onclick", "eval_a_click_event (' A ')");} if (_href! = null) {//re-set the value of the href attribute links.setattribute ("href", "javascript:eval_a_href_event (' A ')");} _event_list["a"] = [links, _href, _click];
})()
function eval_a_href_event (id) {var link = _event_list[id];if (link! = NULL && link[1]! = NULL) {//Gets the value of the href attribute Aler T (Link[1]);//re-assign the href attribute value back to the original value Link[0].setattribute ("href", link[1]);//Remove Click event Link[0].removeattribute ("onclick"); /Impersonation Click event Link[0][0].click ();//Override the value of the href attribute link[0].setattribute ("href", "javascript:eval_a_href_event ('" + ID + "')");// If there is a click event, re-add if (link[2]! = null) {Link[0].setattribute ("onclick", link[2]);}}} function eval_a_click_event (id) {var link = _event_list[id];if (link! = NULL && link[2]! = NULL) {//Get the method of the Click event Aler T (link[2]);//Execute Click event eval (link[2]);}}
JS rewrite the href attribute and onclick event of a tag