我正在尝试使用mousedown事件创建锚。
我的密码
for (i = 0; i < userDetails.length; i++) {
var userProfileURL = "http://www.xyz.com/KLMS/UserProfile.aspx?userid=" + userDetails[i][1];
userTable += "<li><a href=\"" + userProfileURL + "\" onmousedown=\"StoreClickedURL(" + userId + ",'" + encodeURI(userInput) + "','" + encodeURI(userDetails[i][3]) + "')\" title='" + userDetails[i][2] + "'>" + userDetails[i][2] + "</a></li>";
}
通过使用FireBug,我检查了锚,它显示如下
<a href="http://www.xyz.com/PublicProfile.aspx?id=1088" onmousedown="StoreClickedURL(1,'physics','http://www.xyz.com/PublicProfile.aspx?id=1088')">http://www.xyz.com/PublicProfile.aspx?id=1088</a>
它可以在除IE之外的所有浏览器中使用。
在IE中,它也显示了我上面提到的样式锚。
但不会转到mousedown事件中声明的函数。
请帮忙
提前致谢。
最佳答案
尝试这个
< a href="javascript:StoreClickedURL(1,'physics','xyz.com/PublicProfile.aspx?id=1088');window.location = 'xyz.com/PublicProfile.aspx?id=1088'">