how to make a "go to" box
Hi Folks, I need to add a "go to" box on a project I am working on.
The visitor comes to the site with a code. I need a box where they can enter that code and go directly to the correct article in the website. My php is poor, and I'm stuck. I may be going about this all wrong.
To test I have made a text doc called "list.txt" and populated it as follows:
A1234 = "http://www.google.com"
A5468 = "http://www.ebay.com"
A4321 = "http://www.facebook.com"
A9876 = "http://www.youtube.com"
I have then used the following code to reference it:
<input type="text" id ="txtBox" />
<input type="button" name="btnButton" value="Submit" onClick="checkValue()" />
<script <script src="list.txt" type="text/javascript"></script>
<script Language='JavaScript'>
function checkValue() {
var url = document.getElementById('txtBox').value;
window.location.href = (url);
}
</script>
Its a no go, if I put in the code A1234, it trys to find the webpage A1234
however, if I make another variable "test" with the contents A1234 and change the line to:
window.location.href = (test);
it works no problem
any help or advice for a newbie would be really appreciated
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks