Let's say I have this javascript:
<script language="javascript" type="text/javascript">
function addtext() {
var newtext = document.myform.inputtext.value;
document.myform.description.value += newtext;
}
</script>
and I want to enable it so I can click on some html link that says "add text" and I want the text to be @ . $username . (using PHP to insert the username). So when you click the "add text" link it'll put into the textarea @username. It is hard to visualize and I'm not sure where to put the text and PHP exactly. Thanks!
Textarea:
<form Name ="myform" action="<?$posted = $_POST['description'];
$object->post_tweet($posted); ?>" method="post">
<table align="left" border="0" cellspacing="1" cellpadding="5">
<tr>
<td class="2">
<textarea name='description' class="color" COLS=84 ROWS=2 type="text" id="eBann" name="bannerURL" maxlength="100" size="60" onKeyUp="toCount('eBann','sBann','{CHAR} characters left',140);"></textarea>
<br>
<span id="sBann" class="minitext">140 characters left.</span>
</td>
</tr>
</table><BR><BR><BR>
<p><input type='submit' value='Tweet!' /><input type='hidden' value='1' name='submitted' /> </p>
</form>
This is what I want to do with the link:
<a href="#" onclick="addtext("@'. $twit->user->screen_name .'"); return false>reply</a>'
This gives me an error though (I added the addtext function too).
EDIT: Got it! I had mistakes with ' and " haha wow, stupid mistake. Thanks everybody!