将html页面的内容作为内容包含在标记中 [英] To include content of html page as content in a tag

查看:118
本文介绍了将html页面的内容作为内容包含在标记中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我创建了一个页面,我需要在同一个TD标签上打开不同的内容,点击Next按钮也是一样的TD标签。



我正在使用div标签。我写的代码是:

Hi,

I created a page where i need to open different contents in the same TD tag on click on "Next" button which is also in the same TD tag.

I am doing it using div tag. the code which i have written is:

<div id="changeContent" name="changeContent">
<div id="Page1"><iframe src="../history/Page1.html"></iframe></div>
<div id="Page2"></div>
</div>







但这会在一个小窗口打开html页面,而不是页面内容。

(例如:如果我的页面想打开h作为文本和图像,只有文本和图像应该与前一个和下一个按钮一起显示在TD标签中。




but this opens the html page in a small window and not the content of page.
(eg: if the page which i want to open has a text and an image then only text and image should be displayed in the TD tag along with the "previous" and "next" button.

推荐答案

我很高兴你用css解决了它,但使用iframe仍然不是一个好主意。我想的是这样的事情:

I am glad you solved it with css, but using iframes is still not a good idea. I thought rather on something like this:
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>load demo</title>
  <style>
    body{ font-size: 12px; font-family: Arial; }
    table{ width: 100%; }
    td {border: 1px solid red;}
    #content {border: 1px solid green; width: 100%; height: auto;}
    </style>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script>
  var pages = 3;
  var page = 0;
  function load(inc){
    page = (page + inc) % pages;


#content)。load( / page +(page + 1)+ html的);
if (page == 0
("#content").load("/page"+(page+1)+".html"); if(page==0)


#previous)。hide(); else
("#prev").hide(); else


这篇关于将html页面的内容作为内容包含在标记中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆