jquery / javascript를 사용하여 iFrame (주어진 구조의 경우)에서 상위 요소의 html 하이퍼 링크 활성화 / 비활성화

엠마

[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>
Abhidev

당신이 할 수있는 것은 링크를 비활성화하는 부모 페이지에 js 기능이 있습니다.

상위 페이지 js ... 업데이트 됨

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

iframe에서 부모 js 함수를 호출하십시오.

iframe 페이지 js

window.parent.disableLinks();

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관