enable/disable html hyperlink of parent element from iFrame (For given structure) using jquery/javascript -


i trying disable/enable hyperlink few click events may occur on pages,which being loaded in [iframe name="homeframe"] ,event can button click.

div leftnav contains navigation link loaded in [iframe name="homeframe"].

i want know,how can disable/enable links page loaded in iframe.

please guide me same! thanks!

html code:

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

what can have js function in parent page disable links.

parent page js...updated

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

call parent js function iframe

iframe page js

window.parent.disablelinks(); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -