开发者

onload don't load iframe jquery

开发者 https://www.devze.com 2023-02-18 08:59 出处:网络
On my page i have 2 iframes. I have a function to reload the iframe on click. Now I would like to load the main page without loading the 2 iframe.

On my page i have 2 iframes.

I have a function to reload the iframe on click.

Now I would like to load the main page without loading the 2 iframe. Is that possible? How would i do that?

 <ul>
          <li><a href="#discotheque">Discoth&egrave;que</a>
          </li>
          <li><a href="#articlesPresse">Articles de presse</a></li>
  </ul>

  <div id="discotheque">
<a href="javascript: void(0)" onclick="discothequeReload();" style="text-decoration: none" class="">Nouvelle recherche</a>
    <script type="text/javascript">

    function discothequeReload () {
    var f = document.getElementById('discothequeRe开发者_如何学Cload');
    f.src = f.src;
    }
    </script>

                <!--TEST RELOAD-->
        <iframe id="discothequeReload" frameborder="0" src="http://www.google.com">
        </iframe>


  </div>


  <div id="articlesPresse">
        Articles de presse
                <a href="javascript: void(0)" onclick="articlesPresseReload();" style="text-decoration: none" class="">Nouvelle recherche</a>
<script type="text/javascript">

function articlesPresseReload () {
var f = document.getElementById('articlesPresseReload');
f.src = f.src;
}
</script>
            <!--TEST RELOAD-->
        <iframe id="articlesPresseReload" frameborder="0" src="http://www.yahoo.com">
        </iframe>
  </div>


Load the page and load de iframes when the user click on your link? Ok, put the iframe html when the user click. I think that it work's... I remember I made something like this a few months ago.

<a href="#" onclick="discothequeReload();" style="text-decoration: none" class="">Nouvelle recherche</a>

<div id="discotheque">
<!-- without the ifram -->
</div>

<script>
function discothequeReload() { 
    $("#discotheque").html('<iframe id="discothequeReload" frameborder="0" src="http://www.google.com"></iframe>');
}
</script>


If you are saying you would like to redirect from your page to the location of the iframe...

document.location = $("#articlesPresseReload")[0].src;
0

精彩评论

暂无评论...
验证码 换一张
取 消