I found the following online tonight.
---------------
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <script>
- function dynamicurl()
- {
- location.href = document.form1.test.value;
- }
- </script>
- </head>
- <body>
- <form name="form1">
- <input type="text" name="test">
- <a href="#" onClick="dynamicurl();">Click Here</a>
- </form>
- </body>
- </html>
When I put this into an html page, it pops up a small text box where the user can type in anything they want and click the "click here" button. When they do, they are linked from their current location to a folder named just what they typed.
For instance, if they type the word "javascript" into the text box and click the button, they are taken to
http://www.domain.com/javascript
Man, this is sooo close to what I need. I need something that does the same thing, but I'm wondering if there's any way to append something to the beginning and end of the text that was typed in. I want to take them to a particular picture instead of a folder. Using the text "javascript" as an example, I would want the dynamically generated url to be:
http://www.domain.com/bottom-javascript.jpg
So I'm basically adding "bottom-" (with the hyphen) BEFORE the text that was typed in, and then adding the ".jpg" at the end.
Is this something that could be done?
I'm guessing that this line:
location.href = document.form1.test.value;
Is the line that builds the link, but I'm afraid my knowledge of js is, well, I don't have any really......
If anyone in here knows the answer though, I'd be eternally grateful if you could shed some light.
Thanks
Beau