Enabling refreshing for specific html elements only

后端 未结 4 522
长发绾君心
长发绾君心 2020-12-06 10:08

I would like to know how I can only refresh a specific element in my website, instead of the whole web page? The element I\'m talking about is a flash application that loads

相关标签:
4条回答
  • 2020-12-06 10:30

    try to empty your innerHtml everytime. just like this:

    Element.innerHtml="";

    0 讨论(0)
  • 2020-12-06 10:38

    Try creating a javascript function which runs this:

    document.getElementById("youriframeid").contentWindow.location.reload(true);
    

    Or maybe use an HTML workaround:

    <html>
    <body>
    <center>
          <a href="pagename.htm" target="middle">Refresh iframe</a>
          <p>
            <iframe src="pagename.htm" name="middle">
          </p>
    </center>
    </body>
    </html>
    

    Both might be what you're looking for...

    0 讨论(0)
  • 2020-12-06 10:42

    Try this:

    function reload(){
        var container = document.getElementById("yourDiv");
        var content = container.innerHTML;
        container.innerHTML= content; 
        
       //this line is to watch the result in console , you can remove it later	
        console.log("Refreshed"); 
    }
    <a href="javascript: reload()">Click to Reload</a>
        <div id="yourDiv">The content that you want to refresh/reload</div>

    Hope it works. Let me know

    0 讨论(0)
  • 2020-12-06 10:57

    Try this in your script:

    $("#YourElement").html(htmlData);
    

    I do this in my table refreshment.

    0 讨论(0)
提交回复
热议问题