0

[iframe name="homeFrame"] にロードされているページで発生する可能性のあるいくつかのクリックイベントのハイパーリンクを無効/有効にしようとしています。イベントはボタンクリックです。

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">&nbsp;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">&nbsp;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>
4

2 に答える 2

1

あなたができることは、リンクを無効にするjs関数を親ページに持つことです。

親ページ js...更新

function disableLinks(){
   var links = $('#topUL a');
   links.each(function(){
      $(this).click(function(){
          return false;
      });
   });
}

iframe から親 js 関数を呼び出します

iframe ページ js

window.parent.disableLinks();
于 2013-10-07T11:02:02.630 に答える