Charity Gifts - Nike Air Jordans - Secured Loans - Loan - Cheap Flights

PDA

View Full Version : how to add tags into an input field?


falcondriver
Nov 25th 2006, 6:50 am
i have no idea about js, so guess thats an easy one:
on my form is a textarea "tags" and some links below. now i want this linktext in my formfield if someone clicks on it - as seen on del.icio.us on this "submit a site " page. so here is what i got so far:

function addtag(tagname) {
document.submitform.tags.value = document.submitform.tags.value + tagname;
}

<form action="submit.php" method="POST" id="submitform">
<table style="width:100%">
<tr>
<td>URL:</td><td><input type="text" name="url" value="" size="60"></td>
</tr>
<tr>

<td>Tags:</td><td><input type="text" id="tags" name="tags" size="60"><br>
Common Tags: <a href="javascript:addtag('Free')">Free</a>, <a href="javascript:addtag('Paid')">Paid</a>, <a href="javascript:addtag('Recip')">Recip</a>
</td>
</tr>


any ideas....?

lbalance
Nov 25th 2006, 10:23 pm
change your line to this:
document.forms['submitform'].tags.value = document.forms['submitform'].tags.value + tagname;