Use value from textbox (or other user input object) as part of url

S

Strorg

I would like to my visitors to be able to enter a value (say a 4-digit code)
and then use that value as part of a URL. For example: The user enters
their 4-digit code into the textbox and clicks the submit button. The
4-digit code is then concatenated into a text string that is a URL and the
URL is launched.

Any ideas?

Thanks...Tom
 
I

Ivivanti

Yeah, it's pretty easy to do. Here's the complete code. This sample will
replace the page you are looking at with a page that is created by
concatenating the user's input to the question "So, what's the password?".
Of course you can change that one and the string in the body of the code,
too. Most of the other meta tags are FrontPage generated. You'll probably
have your own in your own page. The most important parts below are the
<script> section in the <head> of the document and the <form> section in the
<body> below. Have fun!
=========================================================

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Private Stuff</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Page-Enter"
content="revealTrans(Duration=3.0,Transition=4)">

<script LANGUAGE="Javascript">
//try to load the page requested
function spec_qualify()
{
var resp;
resp = window.prompt("So, what's the password?","");
location.replace("http://www.YOURDOMAIN.com/YOURPATH/" + resp + ".htm");
}
</script>

<meta name="Microsoft Theme" content="pixel 111, default">
<meta name="Microsoft Border" content="t, default">

</head>

<body>
<p align="center">&nbsp;</p>
<p>&nbsp;</p>

<form>
<p align="center">
<input type="button" value="Click here to enter." onClick="spec_qualify()">
</p>
</form>

</body>
</html>

====================================================
 
S

Strorg

Excellent!

Thanks...Tom

Ivivanti said:
Yeah, it's pretty easy to do. Here's the complete code. This sample will
replace the page you are looking at with a page that is created by
concatenating the user's input to the question "So, what's the password?".
Of course you can change that one and the string in the body of the code,
too. Most of the other meta tags are FrontPage generated. You'll probably
have your own in your own page. The most important parts below are the
<script> section in the <head> of the document and the <form> section in the
<body> below. Have fun!
=========================================================

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Private Stuff</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Page-Enter"
content="revealTrans(Duration=3.0,Transition=4)">

<script LANGUAGE="Javascript">
//try to load the page requested
function spec_qualify()
{
var resp;
resp = window.prompt("So, what's the password?","");
location.replace("http://www.YOURDOMAIN.com/YOURPATH/" + resp + ".htm");
}
</script>

<meta name="Microsoft Theme" content="pixel 111, default">
<meta name="Microsoft Border" content="t, default">

</head>

<body>
<p align="center">&nbsp;</p>
<p>&nbsp;</p>

<form>
<p align="center">
<input type="button" value="Click here to enter." onClick="spec_qualify()">
</p>
</form>

</body>
</html>

====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top