![](/img/trans.png)
[英]onclick event on anchor tag works in IE, but not in Firefox and Chrome
[英]Anchor tag onclick event in aspx page works in IE (11) but fails to respond in Chrome and Firefox
aspx頁面中的錨標記onclick事件在IE中有效,但在Chrome和Firefox中無法響應
碼:
<ul> <li> <a Href='Sample.aspx?ID=123' onclick = 'parent.window.frames['FrameRightPanel'].location=this.href;return false;' > Sample </li></ul>
在IE(版本11)中可以正常工作,但在Chrome和Firefox中無法執行任何操作。 我想念什么? 任何幫助。
我不知道為什么我前一段時間沒有意識到這一點,但是為什么不從FrameRightPanel
刪除引號FrameRightPanel
?
onclick = 'parent.window.frames[FrameRightPanel].location=this.href;return false;' >
瀏覽器應將其解釋為JS代碼,然后將替換FrameRightPanel的值。
找到了解決方案。 IFrame缺少名稱屬性!!
之前的代碼是
<iframe id="FrameRightPanel" ></iframe>
新增名稱
<iframe id="FrameRightPanel" name="FrameRightPanel" ></iframe>
現在,它可以在IE,Chrome和FireFox中使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.