...

View Full Version : Populate a textbox by clicking a link



christopheralle
03-18-2005, 05:13 PM
Hi,

i am trying to populate a text box on my page by clicking a link!

I have absolutely no clue how to do it.

here's the situation.

I have a number of links on my page, with a textbox underneath. I want the textbox to be populated with a result depending on what link is clicked.

if another link is clicked afterwards, the textbox should clear the previous result and then populate with the new result.

can anybody help me please.

Thanks very much

Chris

vwphillips
03-18-2005, 06:58 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--

function tb(obj,mess){
document.getElementById(obj).value=mess;
}

//-->
</script>

</head>

<body>
<span onclick="javascript:tb('TB1','Text One');" >Link One</span><br>
<span onclick="javascript:tb('TB1','Text Two');" >Link Two</span><br>
<span onclick="javascript:tb('TB1','Text Three');" >Link Three</span><br>
<input id="TB1" size="10">
</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum