Forum Moderators: open

Message Too Old, No Replies

Script for sequential navigation?

         

creeser

4:31 pm on Mar 23, 2009 (gmt 0)

10+ Year Member



I thought this would be simple to code, but I'm running into issue upon issue. After searching the internet for several hours, I've decided to ask for help.

I'm building a web application for a client. One of the features is a "guided recommendation", which is a link to the next sequential step. That link needs to change depending on what page is loaded in an iframe.

All of the subpages are loaded into an iframe.

For instance, the first time you visit the page, the iframe is loaded with page0.html (Overview)

There's a link on the parent page that says "Recommended Next Step: Before you Begin". If you click that, "Before You Begin" loads into the iframe. In the parent, that link then changes to "Getting Started".

page0.html -Page title "Overview"
page1.html - Page title "Before you Begin"
page2.html - Page title "Getting Started"
page3.html - Page title "Something else"

Any ideas? I'd be most grateful!

whoisgregg

9:07 pm on Mar 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, creeser!

I hate to dodge the actual question here, but if you have control over the .html files themselves it'd probably be easiest to simply hard code a "Next step" link inside the html for each framed page.

Otherwise, you'll have to set up a timer to check the iframe's href every so often to see if it changes then compare the new href against an object with the data about what link should be displayed as next. You'd store the data in something like this:

var next_page = {};
next_page['page0'] = new Array('page1.html', 'Before you Begin');
next_page['page1'] = new Array('page2.html', 'Getting Started');

If you're already doing the iframe navigation using javascript from the parent frame, it might be pretty easy though... If that's the case, perhaps you could show some of that code and we'd be able to show you how to fit in the extra feature?