Jump to content

[SOLVED] Not sure what to call the subject :p


AV1611

Recommended Posts

1st, I know PHP and NOT JS!  :P

 

I have a shoutbox I wrote in php. It works great. when the user does : P for example they get :P .

 

The bottom of the box is a textarea

 

Below the shoutbox is a table with every smiley and code in a td cell.

 

Now, the question.

 

I want to make it so if you click a smily image below it shows up in the textarea above.

 

No clue where to begin, but I 've seen similar before.

 

Help, and be gentle :)

Link to comment
Share on other sites

<form method="POST">

<textarea></textarea>

<input type="submit" value="Shout!" />

</form>

 

then at the bottom a simple table with

 

<td><img.... /> :somecode: </td>

and so on.

 

The code and image are simple replace when the text is displayed. all posts are in database table, and all img name/code are in a table.

 

that's it.

 

Link to comment
Share on other sites

<script type="text/javascript">
function insertSmiley(smiley){
  var txtarea = document.getElementById('smileytext');
  txtarea.value = txtarea.value+smiley;
}
</script> <!-- just modified this, sorry -->
<form method="POST">
<textarea id="smileytext"></textarea>
<input type="submit" value="Shout!" />
</form>

then at the bottom a simple table with

<td><img onclick="insertSmiley('');".... /> :somecode: </td>

 

Try that, modifying it, of course.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.