2015-07-20 163 views
-1

我想通过另一个HTML页面(比如说“page2.html”)显示一个非常大的HTML页面的特定部分(比如“page1.html”),它将包含page1.html每个部分的链接。我怎样才能实现这个使用简单的JavaScript,jQuery等page1.html实际上是通过splunk渲染和page2.html是一个正常的HTML页面,有各种部分page1.html的链接。这可以实现吗?在另一个HTML页面中显示HTML页面的一部分

对不起,由于我的名声低于10

让我澄清一下无法提供图片。在不同的服务器上有一系列的应用程序(超过100个)。每个应用程序都包含一个像page1.html这样的主页面。 page2.html中有一个搜索框,用于输入或选择要查看其统计信息的应用程序。 这些部分引用了我想查看的特定统计信息,假设我只想查看运行该应用程序的服务器统计信息,然后单击链接或按钮(位于page2.html),这会将我带到该部分主页面(即page1.html)显示相关信息。同样,如果我想查看应用程序统计数据,我将点击一个链接或按钮(在page2.html上),该链接或按钮将带我到正在显示应用程序统计信息的主页面的那一部分。

这里是page2.html代码:

<body class="simplexml preload locale-en"> 

<a class="navSkip" href="#navSkip" tabindex="1">Screen reader users, click here to skip the navigation bar</a> 
<div class="header splunk-header"> 
    <div id="placeholder-splunk-bar"> 
     <a href="{{SPLUNKWEB_URL_PREFIX}}/app/launcher/home" class="brand" title="splunk &gt; listen to your data">splunk<strong>&gt;</strong></a> 
    </div> 
     <div id="placeholder-app-bar"></div> 
</div> 
<a id="navSkip"></a> 
<div class="dashboard-body container-fluid main-section-body" data-role="main"> 
<div class="dashboard-header clearfix"> 
    <h2>Application Dashboard HTML</h2> 
</div> 
<div class="fieldset"> 
    <div class="input input-text" id="input1"> 
     <label>Application</label> 
    </div> 
</div> 


<div id="row1" class="dashboard-row dashboard-row1"> 
    <div id="panel1" class="dashboard-cell" style="width: 100%;"> 
     <div class="dashboard-panel clearfix"> 

      <div class="panel-element-row"> 
       <div id="element1" class="dashboard-element html" style="width: 100%"> 
        <div class="panel-body html"> 
          <center><h1 class="golden_gradient">$tok_application$ Application Status Dashboard</h1></center> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
<div id="row2" class="dashboard-row dashboard-row2"> 
    <div id="panel2" class="dashboard-cell" style="width: 100%;"> 
     <div class="dashboard-panel clearfix"> 

      <div class="panel-element-row"> 
       <div id="element2" class="dashboard-element html" style="width: 100%"> 
        <div class="panel-body html"> 
          <table cellspacing="5" cellpadding="5" border="0" width="100%"> 
           <tr> 
            <td width="50%"> 
             <pre><a style="text-decoration: none" onclick="loadURL()"><font size="4"><p align="center"><b>Website Availability</b></p></font></a></pre> 
            </td> 
            <td width="50%"> 
             <pre><a style="text-decoration: none" onclick="loadDBStat()"><font size="4"><p align="center"><b>Database Availability</b></p></font></a></pre> 
            </td> 
           </tr> 
           <tr> 
            <td width="50%"> 
             <pre><a style="text-decoration: none" onclick="loadBM()"><font size="4"><p align="center"><b>Batch Jobs</b></p></font></a></pre> 
            </td> 
            <td width="50%"> 
             <pre><a style="text-decoration: none" onclick="loadIT()"><font size="4"><p align="center"><b>Infrastructure Dashboard</b></p></font></a></pre> 
            </td> 
           </tr> 
           <tr> 
            <td width="50%"> 
             <pre><a style="text-decoration: none" onclick="loadBusiness()"><font size="4"><p align="center"><b>Business Dashboard</b></p></font></a></pre> 
            </td> 
            <td width="50%"> 
             <pre><a style="text-decoration: none" onclick="loadCMRegression()"><font size="4"><p align="center"><b>Capacity Management Regression</b></p></font></a></pre> 
            </td> 
           </tr> 
          </table> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
<div id="content"></div> 
</div> 
</body> 

我想要的母版页的部分印刷内部

<div id="content"></div> 

而且我是新手,所以请您提供一点细节的解释。提前致谢。

+0

如果你想有一个很好的答案,你必须先学会[如何提问](http://stackoverflow.com/help/on-topic)的适当的问题 – musefan

+0

你可以截图page1.html并将其放在page2.html上吗? –

+0

或从page1.html中复制html代码,然后将其添加到page2.html,我不太确定您的需求。 –

回答

2

http://www.w3schools.com/html/html_iframe.asp有一种使用iframe显示网页链接的方法。

<iframe width="100%" height="300px" src="demo_iframe.htm" name="iframe_a"></iframe> 
<p><a href="http://www.w3schools.com" target="iframe_a">W3Schools.com</a></p> 

<p>When the target of a link matches the name of an iframe, the link will open in the iframe.</p> 

[从w3scools.com采取代码]

+0

非常感谢MrEhawk82 + 1投票 –

相关问题