coldfission Posted July 1, 2008 Share Posted July 1, 2008 This code will loop through the pages array and send them to the iframe. Once the page is loaded, it continues onto the next page source. This is similar to what i want, But I don't want the page to reload to the next one until the user reaches a certain point on that page source. This is because each individual page prompts the user to enter information. After the user enters their information, i want it to continue on to the next page source. How do i do this? <html> <head> <script type="text/javascript"> var pages = []; pages[0] = "http://www.blahblah.com/blah"; pages[1] = "http://www.blahblah.com/blahblah"; function updateFrame() { // get the frame var frame = document.getElementById("loopingFrame"); if(!pages[frame.pageIndex]) { // first iteration -- initialize the properties frame.pageIndex = 0; frame.count = 1; } else if(pages.length <= (parseInt(frame.pageIndex)+1)) { frame.pageIndex = 0; // we've gone through all the pages this time, increment count frame.count++; } else { // no need for a new number, just a new base page frame.pageIndex++; } var pageIndex = frame.pageIndex; var i = frame.count; frame.src = pages[pageIndex] + i; } </script> </head> <body> <iframe id="loopingFrame" src="http://www.blahblah.com/blah" onload="updateFrame();"> </iframe> </body> </html> Quote Link to comment Share on other sites More sharing options...
lemmin Posted July 1, 2008 Share Posted July 1, 2008 Do you mean that, in the iframe, every time the user activates a certain input, the page will go to the next page in the array? if so, something like this should work: <script type="text/javascript"> var pages = []; pages[0] = "http://www.blahblah.com/blah"; pages[1] = "http://www.blahblah.com/blahblah"; var index = 0; function nextPage() { var frame = document.getElementById("loopingFrame"); frame.src = pages[index]; index++; } </script> <button onClick="nextPage()">Next Page</button> Quote Link to comment Share on other sites More sharing options...
coldfission Posted July 2, 2008 Author Share Posted July 2, 2008 thanks thats what i needed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.