Guest Vivian Lee Posted November 4, 2007 Share Posted November 4, 2007 OK, I created an iframe. And below it, I created two navagational buttons; one's "next" and the other's "previous".I also have pages and pages of information that should show up in the iframe. So my question is: how do I make it so that when I click my "next" or "previous" button, it would go page after page? So far I only managed to view two pages....And I'm also a beginner at this stuff, so it shouldn't be too hard.Thanks to anyone who offers help! Link to comment Share on other sites More sharing options...
webspider25 Posted November 4, 2007 Share Posted November 4, 2007 Hi Lee,Basically u can get this only if ur iframe n webpage is refreshing everytime.so byt his u can add link og next page page by page with help og hTMl/CSSBut if u want that the webapage shuld remain the same and thecontent uploaded in the same iframe evrytime than u ahve to use javascript.bye OK, I created an iframe. And below it, I created two navagational buttons; one's "next" and the other's "previous".I also have pages and pages of information that should show up in the iframe. So my question is: how do I make it so that when I click my "next" or "previous" button, it would go page after page? So far I only managed to view two pages....And I'm also a beginner at this stuff, so it shouldn't be too hard.Thanks to anyone who offers help! Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted November 4, 2007 Share Posted November 4, 2007 You need to add the name attribute to your iframe, like this: <iframe src="page.html" name="something"></iframe> And your next/previous links need to target the iframe, so: <a href="nextpage.html" rel="next" target="something"><img src="next.gif" alt="Next" /></a> (I assume you are using images)As for previous: <a href="previouspage.html" rel="prev" target="something"><img src="prev.gif" alt="Previous" /></a> Of course you need to change the previouspage.html and nextpage.html to the actual pages, and I assume that the images are called next.gif and prev.gif. But that should be sufficient to remedy the problem. Link to comment Share on other sites More sharing options...
Synook Posted November 5, 2007 Share Posted November 5, 2007 I think his problem is that because the "next" and "previous" links are hard-coded and only change once (at load time) after he clicks "next" the second time it is clicked the same page will load again...You could, as webspider said, use JavaScript to dynamically load the page, so say your pages to be loaded into the iframe were called page_1.html, page_2.html, page_3.html, etc. <script type="text/javascript"> function movePage(sign) { thisPage = parseInt(document.getElementById('page').innerHTML); thisPage = thisPage + sign; if (thisPage < 1) thisPage = 1; document.getElementById('page').innerHTML = thisPage; document.getElementById('iframe').src = "page_" + thisPage + ".html"; return false; }</script><iframe src="page_1.html" id="iframe"></iframe><br /><a href="#" onclick="return movePage(1)" id="prev_button">Previous Page</a>Your current page is page <span id="page">1</span><a href="#" onclick="return movePage(-1)" id="next_button">Next Page</a> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.