使用'在新标签中打开,打开主要内容div中的另一个页面...'

时间:2016-10-05 01:33:43

标签: javascript html css

当使用&#34点击主要内容链接时,在新标签页中打开链接..."选项,我想用侧边栏和标题加载主要内容中的页面。 请参阅下面的图片,看看它应该是什么样的。

提前致谢。

Before 点击链接前的页面。

After 点击链接后的页面。

请参阅Fiddle demo

 <a target="_blank" href="https://jsfiddle.net/bumbumpaw/2e16m0c4/">This should load href value in main content w/ Sidebar,Header and Footer</a>

2 个答案:

答案 0 :(得分:0)

我认为你必须看jquery load()。它将从另一个链接加载html内容并通过ajax附加到html元素。

例如

$( "#result" ).load( "ajax/test.html", function() {
  alert( "Load was performed." );
});

答案 1 :(得分:0)

如果要加载外部页面,可以用iframe替换#contents的内容。 Demo

    $("a").on('click', function(ev)  {
    ev.preventDefault();
    $('#content').html("<iframe src='http://www.w3schools.com'></iframe>");});
相关问题