<html> <body> <input type="text" id="msg"> <a href="#" onclick ="(document.getElementById('msg').value=document.getElementById('msg').value + ':lol:')"><img src="x.jpg"></a> </body> </html>