View Full Version : Updating textbox with links assitance

12-30-2005, 09:37 PM
Is there a way to do the following in Javascript?

I have a list of words that I whish to convert into links to add to a textbox

$list="Blue; Clear Sky; Erode; Erosion; Pole; Sea; Shadow; Sky; Weather; Wood";

What I need is to get each one as a link

<a href="#" onClick="addToTextbox()">Blue</a>
<a href="#" onClick="addToTextbox()">Clear Sky</a>
<a href="#" onClick="addToTextbox()">Erode</a>

But everytime the user clicks a new word it will be added to the ones already in the textbox, with a " AND " prefix

Thnaks in advance for any help

Mr J
12-31-2005, 09:15 AM
Do You mean something like this?

<script type="text/javascript">

function addToTextbox(str){

document.forms["formName"]["t1"].value+=" AND "+str


<form name="formName">
<input type="text" name="t1" size=80>

<a href="#" onClick="addToTextbox('Blue')">Blue</a>
<a href="#" onClick="addToTextbox('Clear Sky')">Clear Sky</a>
<a href="#" onClick="addToTextbox('Erode')">Erode</a>

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum