首页  >  问答  >  正文

javascript - 如何能实现不刷新的在页面嵌入页面

当我点击左边的侧栏的时候,我能在预留窗口中看到无刷新的页面显示,用js可以实现不。

PHP中文网PHP中文网2749 天前296

全部回复(2)我来回复

  • 天蓬老师

    天蓬老师2017-04-10 14:47:40

    可以的。
    AngularJs之类的MVVM框架就是这么玩儿的。模版通过ajax请求过来,js渲染到DOM里。

    回复
    0
  • 黄舟

    黄舟2017-04-10 14:47:40

    Not sure what you mean. If "预留窗口" is referring to a <iframe>:

    Updating DOM in an <iframe> is possible, you can acquire the document object of the frame using
    iframeElement.contentDocument || iframeElement.contentWindow.document, then modify it. You can also call functions defined inside <iframe> using iframeElement.contentWindow directly.

    Notice you'll need to follow same-origin policy in order to do so.

    回复
    0
  • 取消回复