First Time Poster!![]()
I have a html page with frames.. On my botton frame, I have some buttons (backward and forward) These button are ran with a nav.js script that I have.
This script navigates thru htm pages by array.
The problem I am having is trying to navigate with bookmarks.
var pages = Array("one.htm#I","two.htm#II","three.htm#III","four.htm#IV",
"five.htm#V","six.htm#VI")
Now if I naviagate with regular htm pages, the script works fine.
Problem:
What's happening is when I click the forward button it advances to every other bookmark instead of the proceeding one.
Any help appreciated..
I'll post the script here..
THANKS!Code:// List Pages for bottom navigation buttons ... Links must be in the same order as on left menu page. var pages = Array("one.htm#I","two.htm#II","three.htm#III","four.htm#IV", "five.htm#V","six.htm#VI") var top_frame = parent.top_frame; function arrayIndex(array, key){ for (i = 0; i < array.length; i++){ if(array[i] == key){ return i; } } return false } function getPage(target){ path = target.location.href; file = path.substr(path.lastIndexOf("/")+1); return file } function goForward(target, cur_index){ next_index = cur_index + 1; if (pages.length > next_index){ target.location.href = pages[next_index]; } return next_index; } function goBackward(target, cur_index){ next_index = cur_index - 1; if (next_index >= 0){ target.location.href = pages[next_index]; } return next_index; } function nav(direction){ cur_index = arrayIndex(pages, getPage(top_frame)); if (direction == "forward"){ new_index = goForward(top_frame, cur_index); } else if (direction == "backward"){ new_index = goBackward(top_frame, cur_index); } maintain(new_index) } function next(e){ nav("forward"); } function prev(e){ nav("backward"); } function maintain(cur_index){ back_button = parent.bottom_frame.document.getElementById("backward"); next_button = parent.bottom_frame.document.getElementById("forward"); init(); if (cur_index == 0){ back_button.style.display = "none"; } } function init(){ back_button = parent.bottom_frame.document.getElementById("backward"); next_button = parent.bottom_frame.document.getElementById("forward"); back_button.style.display = "inline"; back_button.value = "Back"; back_button.onmouseup = prev; next_button.style.display = "inline"; next_button.value = "Forward"; next_button.onmouseup = next; } maintain(0);


Reply With Quote
Bookmarks