我試圖禁用/啓用超鏈接的頁面上可能發生的幾個點擊事件,正在加載[iframe name =「 homeFrame「],事件可以是按鈕點擊。啓用/禁用從iFrame中的父元素的HTML超鏈接(對於給定的結構)使用jquery/javascript
div leftNav包含導航鏈接,它會在[iframe name =「homeFrame」]中加載。
我想知道,如何禁用/啓用從Iframe中加載頁面的鏈接。
請指導我一樣!謝謝!
HTML代碼:
<html>
<body>
<form name="frmHome">
<div id="MainDivH" style="background-image:url(images/headerbg.jpg); background-repeat:repeat-x; width:100%;">
<div id="header" style="width:984px; font-family:Calibri; padding-left: 37px;">
</div>
<div id="divNavigation" class="divNavigation" style="padding-left:37px; float:left;">
<div id="countrydivcontainer" style="float:left" >
<div id="divProduct" style="padding-bottom:20px; padding-top:20px; position:static;">
</div>
<div id="PCcontentWrapper">
<div class="leftNav" style="font-size:14px; font-weight:normal;">
<ul id="topUL">
<div background:url(images/pcnav.png) left top no-repeat;">TEST LINKS</div>
<li style="text-align:center;"><a id="202" name="test1" class="test" href="javascript:void(0);" onclick="javascript:top.frames['homeFrame'].location='TestLink/link1.php'" target="homeFrame"> Test 1</a></li>
<li style="text-align:center;"><a id="204" name="test2" class="test" href="javascript:void(0);" onclick="javascript:top.frames['homeFrame'].location='TestLink/test2.php'" target="homeFrame"> Test 2</a></li>
</ul>
</div>
<!--End of left nav-->
<div class="pcContener" id="pcContener" style="float:right; padding-left:20px;">
<iframe name="homeFrame" id="homeFrame" scrolling="no" style="height:750px; float:right; width:758px; font:Calibri; overflow:hidden;">
</iframe>
</div>
</div>
</div> <!--End of PCcontentWrapper-->
</div> <!--End of divNavigation-->
</div> <!--End of MainDivH-->
</form>
</body>
這聽起來像一個XY-問題 - http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem - 請介紹一下X! – Halcyon
你想要在你的iframe頁面禁用你的父頁面的鏈接? – Abhidev
@Abhidev:是的,我正在嘗試同樣的事情。 – Emma