简体   繁体   中英

HREF on <a> not being followed in IE8 after onclick event?

On the following page, the orange "Buy Topo Map" link will open a page in IE7 (and Firefox and Safari), but not in IE8. The link is in the top-left.

http://www.trailbehind.com/node/1148091/

I am using the following code to create the link:

var a = dec('a');
a.className = 'jLink';
a.style.fontWeight = 'bold';
a.style.color = '#CC5500';
a.style.fontSize = '.8em';
a.target = '_blank';
a.href = 'http://www.mytopo.com/searchgeo.cfm?lat=' + map.target.la + '&lon=' + map.target.lo+'&pid=trailbehind';
a.onclick = function () {
  pageTracker._trackEvent("Orange Link", "Buy Topo Map", this.href);
  return true;
}
a.appendChild(dct('Buy Topo Map'));

What's the matter?

Works fine for me, although IE8's devtools indicate the following runtime error:

Line: 323 Error: 'pageTracker' is null or not an object

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM