I was wondering how i could make it where when someone would click on one of the emoticons it would show up like :test: in the text field? i have all the bbcoding but i dont know how they make it place in the field without accually typing it in?
can someone help me Please
Thank you
Smackie
help with BBCode
Moderator: General Moderators
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
i will provide you the logic.
you have to wrap images in <a> and for the onclick event provide relevant javascript call
for ex:
and using javascript, add the value got by the function into the textarea/ div using dhtml.
later you can parse the GET or POST variable in PHP and replace those values with <img> tags.
you have to wrap images in <a> and for the onclick event provide relevant javascript call
for ex:
Code: Select all
addemoticon("test:");later you can parse the GET or POST variable in PHP and replace those values with <img> tags.
Code: Select all
<script language="javascript" type="text/javascript">
<!--
function insertSmilie(text) {
text = '' + text + '';
if (document.frmPost.txtPost.createTextRange && document.frmPost.txtPost.caretPos) {
var caretPos = document.frmPost.txtPost.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? text + '' : text;
document.frmPost.txtPost.focus();
} else {
document.frmPost.txtPost.value += text;
document.frmPost.txtPost.focus();
}
}
//-->
</script><input type="text" name="name" id="txtPost">
<input type="submit" value="submit">
</form>
Smiley Face: <a href="#" onClick="insertSmiley(':text:');">smiley</a>
Code: Select all
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.