How do I reference a sibling frame with Jquery/Javascript? -


here's main index.html:

<frameset cols="200,*" border="0" frameborder="0" framespacing="0">     <frame name="nav" id="nav" src="nav.html" />     <frame name="content" id="content" src="1.html" /> </frameset> 

here's nav.html:

<body>     <ul>         <li><a href="1.html" target="content" id="test">1</a></li>         <li><a href="2.html" target="content">2</a></li>     </ul> </body> 

here's 1.html:

<body>     <script type="text/javascript">     $("#content").ready(function() {          $("#nav").contents().find('#test').html('selected');     } ); </script> </body> 

what want: when right frame (1.html) loads, changes in left frame (nav.html).

the syntax doesn't seem work in second line ($("#nav").contents()...) because when test "#contents" doesn't work either, when change "this".

i believe need access javascript object window.parent.frames[0].document or [1] access frame.

in jquery can put second parameter so:

$("#nav", window.parent.frames[0].document).find("#test").html("selected"); 

that , when accessing window object on same domain.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -