hyperlink generation with textbox

April 12, 2012 at 23:21:07
Specs: Windows XP, about 4 gb
how do i generate hyperlink, partially using textbox(html)?
this is what i need:
a textbox, with a submit button; when the button is pressed it wil link to a site like:
www.computing.net
but the textbox has to add something to the link:
textbox=i_need_help
link= www.computing.net/i_need_help.htm

See More: hyperlink generation with textbox

Report •


#1
April 13, 2012 at 02:12:55
Have you tried something like?
(beware: untested code, will need tweaking)

<head>
<script language="javascript">
function goToUrl()
{
var textbox = document.getElementById("myTextBoxId");
var url = "http://www.computing.net/";
if (textbox != null && textbox != "undefined" && textbox.value != null && textbox.value.length > 0)
{
url = url + textbox.value;
}
window.location = url;
}
</script>
</head>

<body>

< a href="javascript:goToUrl()">Go!</a>

</body>

hth

Elinor Hurst
http://elinorhurst.blogspot.com


Report •
Related Solutions


Ask Question