Clicking on a link that adds text to the end of a text box

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Clicking on a link that adds text to the end of a text box

Post by like_duh44 »

My question is I have a link, and if clicked, I want it to place a certain string on the end of the content that is in a text box. Kind of like this, but this just replaces whats in the box, I want it to add it to the end.

Code: Select all

<?php

echo "<a href="#" onclick="document.message.post.value='  ';return false;">Click to add  to your post</a>";

echo "<form name="message">";

echo "<input type="text" name="message">";

?>
But the problem with this is that it replaces the text that is in the text box, how do I have it add it to the end of it?
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

Code: Select all

<?php
echo "<a href="#" onclick="document.message.post.value =  document.message.post.value + 
':)';return false;">Click to add  to your post</a>"; 
echo "<form name="message">";
echo "<input type="text" name="message">"; 
?>
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

NVM, found out that this works:

document.message.post.value += ' :) '

EDIT: LOL, just missed your post. Thanks anyway
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

Hey qads, what script did you make to change the 'image.jpg' on your site to change every second or whatever?
Post Reply