469,354 Members | 2,150 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Text field requesting page number to go to

I have an index page for an online mag that I'd like to include a text field with "Go to page" text field, and a Go button. I would like the user to be able to type in the page number they want to go to and when submitted it gathers that information and goes to the correct page.

I have been searching for this for days. I must not be searching on the right words because I'm just not finding the answer. Any help would be grately appreciated!!!

Thanks,
GG
Mar 1 '07 #1
5 1539
drhowarddrfine
7,435 Expert 4TB
This can't be done with html or css. You need a programming language, in this case, javascript. I will move this to that board so you can get help there.
Mar 1 '07 #2
AricC
1,892 Expert 1GB
I have an index page for an online mag that I'd like to include a text field with "Go to page" text field, and a Go button. I would like the user to be able to type in the page number they want to go to and when submitted it gathers that information and goes to the correct page.

I have been searching for this for days. I must not be searching on the right words because I'm just not finding the answer. Any help would be grately appreciated!!!

Thanks,
GG
A few things, do you want them to type page numbers? I'm not really sure how that would work unless your pages are titled 1.htm 3.htm etc... If your looking for a site search you may need to use server side scripting. Lastly, are you trying to do this with HTML only? I think at least you need javascript.
Mar 1 '07 #3
thank you drhowarddrfine for moving my post to the javascript discussion board. I thought that was where it needed to be but couldn't find anything pertaining to that when searching javascript for this topic.

The pages are named page1.html, page2.html, etc. I can name them whatever will help make this work. There is a mysql database set up for backend admin so I could use a server side script. What would work?

Thanks very much!
Mar 1 '07 #4
acoder
16,027 Expert Mod 8TB
You can do this without server-side code by taking the form value and changing the location. Are you sure everyone will have javascript turned on? If not, you should use a server script or provide links to the other pages.

Anyway, with javascript, use the button onclick event handler to call a function which gets the text input value. Once you have this value, parse it to make sure it's an integer. If it's between 1 and the last page number, just relocate the browser to the new page:
Expand|Select|Wrap|Line Numbers
  1. location.href="page"+num+".html";
where num is your parsed number from the input box.
Mar 1 '07 #5
thanks everyone for your help!
Mar 1 '07 #6

Post your reply

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

Similar topics

1 post views Thread by dmiller23462 | last post: by
1 post views Thread by PC User | last post: by
3 posts views Thread by Alexander | last post: by
6 posts views Thread by Lelle | last post: by
11 posts views Thread by Mike Harrison | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.