user472285
user472285

Reputation: 2674

onload don't load iframe jquery

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('discothequeReload');
    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>

Upvotes: 1

Views: 2315

Answers (2)

Curlas
Curlas

Reputation: 899

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>

Upvotes: 1

mattsven
mattsven

Reputation: 23253

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

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

Upvotes: 0

Related Questions