469,643 Members | 2,061 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

updating URL and passing URL info with frames and js...

Ok, Here is my situation... we have a 64 page pdf that we have broken up into separate pages. We are needing a frame set to have a "Previous Page and Next Page" navigation at the bottom of the window. I am wanting to capture the URL in the top frame where the PDFs are displayed and update the URL of the URL/pdf to be +1 or -1. Example of top frame URL: www.MySite.com/pdf/page01.pdf so now the bottom frame needs to read the URL and see "page01.pdf" add one (+1) to the 01 to make it 02 (page02.pdf). I understand that once at 01 that you can't go to 00 or that at page 64 we cannot goto 65, we are only offering 64 pages. But right now, I can't seem to get the URL to pass, read, and updated to be the next or previous page.

I have searched and tried too get some hints, tips or tricks but mostly coming across passing Queries after the URL... which is interesting read, but not assisting with my issue at hand. So in a nutshell, HELPPPPP!!! please?

function showDef(t) {
top.Frame1.activeDef = top.Frame1.location.href.window.frameElement("page " + t);

<in the body>
<a href="#" onclick="showDef(+1)">Next

I know that we can back up on the URL, but am I heading in the wrong direction with this or what?

Jan 23 '07 #1
2 1364
Ok, I just found this http://javascript.about.com/library/blurl2.htm which provided a method for getting the information but now I am doing it with frames and still need to add or minus...
Jan 23 '07 #2
16,027 Expert Mod 8TB
Assuming you have figured out how to obtain the url and the file name, e.g. page01.pdf, there are a number of ways to search the string to gain what you need.

You could use regular expressions to get the current page number (01) or
search the string for page and the .pdf and get the value in between. For this, you can use string methods such as indexOf, match, substr, etc. See here.

You are passing +1 when in fact you should be passing just 1. In your function, parse the 01, 02, etc. current page value using parseInt(). Then add 1 or whichever number you have passed. Obviously, if you reach 64, the next button/link should not even be available. Now to maintain the leading zero, just include the following:
Expand|Select|Wrap|Line Numbers
  1. if (pageno < 10) t = '0'+pageno;
Hope that helps.
Jan 24 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by divya | last post: by
1 post views Thread by Roy Adams | last post: by
1 post views Thread by cirillo_curiosone | last post: by
6 posts views Thread by KKramsch | last post: by
2 posts views Thread by elik | last post: by
3 posts views Thread by Jon Agiato | last post: by
1 post views Thread by | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.