PDA

View Full Version : Inserting from text box to web address


BjV
11-11-2002, 07:03 PM
OK, let me see if I can explain this.
What I would like to do is type a number into a textbox and have that number inserted into a web address.
Like: webpage.com/info from textbox.html
Can this be done in JS?

Sorry for the obscurity

:confused:

Borgtex
11-11-2002, 07:16 PM
Seen the link. Redirected to another site (www.adultsite-chat.com).

Still don't understand your question :(

BjV
11-11-2002, 07:30 PM
Ignore the link :) it was an example. I just want to be able to insert the info from the text box into the link.

Sorry for the redirect it wasn't intended

dewcansam
11-11-2002, 07:44 PM
I think you are trying to do this:


<html>
<head>
<script language="javascript">
function testScript()
{
document.myForm.output.value = "http://www.somesite.com/" + document.myForm.linkNum.value + ".html";
}

</script>
</head>
<body>
<form name="myForm">
<input type="text" name="linkNum" value="01">
<input type="button" value="Test Script" onClick="testScript();">
<input type="text" name="output">
</form>
</body>
</html>


If thats anywhere close let me know.

x_goose_x
11-11-2002, 08:07 PM
I think this is what (s)he was looking for:


<html>
<head>
<script language="javascript">
function testScript()
{
location.replace("http://www.somesite.com/" + document.myForm.linkNum.value + ".html");
}

</script>
</head>
<body>
<form name="myForm">
<input type="text" name="linkNum" value="01">
<input type="button" value="Test Script" onClick="testScript();">
</form>
</body>
</html>

dewcansam
11-11-2002, 08:18 PM
<meBeingLazy>
Yeah, I just didn't feel like going down the road of actually replacing the page. :)
</meBeingLazy>

BjV
11-11-2002, 08:59 PM
Thanks Goose That's it. Hats off to both of you.:thumbsup:

BjV
11-12-2002, 04:23 PM
One more question ( I hope somebody see's this )
How would I get the results from the above script to open into a new browser window.

A1ien51
11-12-2002, 07:39 PM
location.replace(".......blah.....

change to

NewWin = window.open("......blah.......

BjV
11-12-2002, 08:17 PM
Thank you A1ien51 that worked:thumbsup: