Click here to Skip to main content
16,020,378 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:
XML
<div id="changeContent" name="changeContent">
<div id="Page1"><iframe src="../history/Page1.html"></iframe></div>
<div id="Page2"></div>
</div>



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.
Posted
Updated 23-Aug-13 19:54pm
v2
Comments
Zoltán Zörgő 24-Aug-13 1:59am    
Not clear what you want or how confused you really are. IFRAME is a frame in the document, that can contain anything. It's size can be set by properties or css, but yes it looks like a small window in the page. And you speak about TD element, but there is no TD in your code (by the way using DIVs is a better approach, but implies more css). So please explain or draw some images and upload so we can see what you want.
archies_gall 24-Aug-13 4:01am    
I am not able to attach the file here.
Zoltán Zörgő 24-Aug-13 4:14am    
No, but you can share on other sites, and link here. But at least try to give a more comprehensive description.
archies_gall 24-Aug-13 6:47am    
Please see the below link:

https://docs.google.com/file/d/0B8x7KQUPwp1KVTAzUDFfOU43Wms/edit
archies_gall 24-Aug-13 6:55am    
https://docs.google.com/file/d/0B8x7KQUPwp1KeGFFU184RHpZaWM/edit?usp=sharing

1 solution

I am glad you solved it with css, but using iframes is still not a good idea. I thought rather on something like this:
HTML
<!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) $("#prev").hide(); else $("#prev").show();
    if(page==pages-1) $("#next").hide(); else $("#next").show();
  }

  $(function() {
     load(0);
    });
  </script>
</head>
<body>

<table>
<tr>
<td></td>
<td width="70%" align="center">
<div id="content">

</div>
<a id="prev" href="#" onClick="load(-1);"><img class="imgCustom1" src="../Images1/previous.png" align="left" alt="Previous page"></a>
<a id="next" href="#" onClick="load(+1);"><img class="imgCustom1" src="../Images/Next.png" align="right" alt="Next page"></a>
</td>
<td></td>
</tr>
</table>


</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900