Hi,
Does anybody know a code where i can type the name of a page on my site in a text area, press a submit button and it will take me straight to that page.
For example, My site was in the code ( http://mysiteurl.com/ ), then when you type the name of the page into the text area and press submit, it will take you to that page ( http://mysiteurl.com/page )
Help would be much appreaciated .
Last edited by chrishirst; 10-23-2008 at 01:46 PM..
Reason: Silly formatting removed so the post is READABLE!
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
There's a couple different way to do it, though I've never thought about it. It is pretty simple, but definitely requires a server-side code, or else JavaScript, as Chris has pointed out. Why don't you bring it up in one of the other channels?
__________________
I build web things. I work for the startup Please login or register to view this content. Registration is FREE .
do you mean there is no code or you dont know one? I thought it would be a simple html!
there is no "simple HTML" code that can do that.
the simplest javascript would be onblur="window.location.href = this.value" on the text input.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
Last edited by chrishirst; 10-24-2008 at 09:29 AM..
Reason: corrected my hastily typed syntax
brilliant thanks radGH, thats exactly what i wanted. But is there any way i could pre-define the first part of the location, because it just adds the name of the page at the end of the current page its on eg (http://www.myurl/currentpage/pageIwanttogoto) instead of (http://www.myurl/pageIwanttogoto) so it doesent take me to that page.
You could change the "window.location += url" to "window.location = 'http://website.com/'+url".
Just using "window.location = '/'+url" would have the same effect and make the script portable.
Quote:
Originally Posted by webmaster flex
great, that works perfectly!
but if the page typed in does'nt exist, how would i make i take you to another page, to tell them.
Have a custom 404 page.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
you would have to use a xmlHTTPRequest (AJAX) to do that.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
The assumption there being the OPs site can use PHP
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
Your help is much appriciated decaf, but the host im with at the moment does'nt support php, so i wanted the code to be in javascript/html untill I get a new host