[Javascript] Dynamically generate link from text being typed in textbox?

Hassan Schroeder hassan at webtuitive.com
Thu Jan 17 16:27:51 CST 2002


David Yee wrote:
> 
> Hi all.  I'm wondering is it possible to dynamically generate a link as text
> is being typed into a particular text box.  Basically I want the link to
> contain a GET variable name and value without submitting the form (the form
> actually posts to another page).  

So someone can either submit the form *or* click on the link to go
to that page?

Something like this will work on NS4, NS6, IE5:

<script type="text/javascript">

	var foo = "http://some.default.url/";

	function qOpen()
	{
		window.location = foo;
	}	

</script>

<a href="javascript://;" onclick="qOpen();return false;">a link</a>

<form method="post" action="/whatever/process.cgi">

	<input type="text" onblur="foo=this.value;" />
	<input type="submit" value=" submit " />
</form>

HTH!
-- 
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com 
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --



More information about the Javascript mailing list