JavaScript | Помогите с js смайлами
[hljs class="javascript"]<script language="JavaScript" type="text/javascript">
function tag(text1, text2) {
if ((document.selection)) {
document.message.text.focus();
document.message.document.selection.createRange().text = text1+document.message.document.selection.createRange().text+text2;
} else if(document.forms['message'].elements['text'].selectionStart!=undefined) {
var element = document.forms['message'].elements['text'];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
document.forms['message'].elements['text'].focus();
} else document.message.text.value + text1+text2;
document.forms['message'].elements['text'].focus();}</script>
<script type="text/javascript">
function look(t){
p=document.getElementById(t);
l=document.getElementById("a-"+t);
if(p.style.display=="none"){
l.innerHTML='<img src="/img/smisl.gif" align="center" alt="" height = "20" width = "20"/>';
p.style.display="block";}
else{
l.innerHTML='<img src="/img/smisl.gif" align="center" alt="" height = "20" width = "20"/>';
p.style.display="none";}
}
</script>
<a class="auth" href="javascript:look('text1');" id="a-text1"><img src="/img/smisl.gif" align="center" alt="" height = "20" width = "20"/></a>
<div id="text1" style="display:none; text-align:justify;">
<div style="margin:4px;">
<a href="javascript:tag(':)', '')"><img src="/smiles/smile.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.сердит.', '')"><img src="/smiles/serdit.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.секрет.', '')"><img src="/smiles/secret.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.крут.', '')"><img src="/smiles/o4ki.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.миг.', '')"><img src="/smiles/mig.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.кисс.', '')"><img src="/smiles/kiss.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.глаза.', '')"><img src="/smiles/glaza.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':D', '')"><img src="/smiles/biggrin.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':(', "")"><img src="/smiles/bad.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.че.', '')"><img src="/smiles/4e.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':зев', '')"><img src="/smiles/28a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':рад', '')"><img src="/smiles/51a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':сплю', '')"><img src="/smiles/46a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':люб', '')"><img src="/smiles/44a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':мечт', '')"><img src="/smiles/41b.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':фигасе', '')"><img src="/smiles/27a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':ах', '')"><img src="/smiles/26a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':язык', '')"><img src="/smiles/14a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':плак', '')"><img src="/smiles/13a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':лыба', '')"><img src="/smiles/11a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':злой', '')"><img src="/smiles/10a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':подмиг', '')"><img src="/smiles/09a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':сум', '')"><img src="/smiles/03a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':хмур', '')"><img src="/smiles/01.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':дум', '')"><img src="/smiles/07a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':грусть', '')"><img src="/smiles/06a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':улыбка', '')"><im
function tag(text1, text2) {
if ((document.selection)) {
document.message.text.focus();
document.message.document.selection.createRange().text = text1+document.message.document.selection.createRange().text+text2;
} else if(document.forms['message'].elements['text'].selectionStart!=undefined) {
var element = document.forms['message'].elements['text'];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
document.forms['message'].elements['text'].focus();
} else document.message.text.value + text1+text2;
document.forms['message'].elements['text'].focus();}</script>
<script type="text/javascript">
function look(t){
p=document.getElementById(t);
l=document.getElementById("a-"+t);
if(p.style.display=="none"){
l.innerHTML='<img src="/img/smisl.gif" align="center" alt="" height = "20" width = "20"/>';
p.style.display="block";}
else{
l.innerHTML='<img src="/img/smisl.gif" align="center" alt="" height = "20" width = "20"/>';
p.style.display="none";}
}
</script>
<a class="auth" href="javascript:look('text1');" id="a-text1"><img src="/img/smisl.gif" align="center" alt="" height = "20" width = "20"/></a>
<div id="text1" style="display:none; text-align:justify;">
<div style="margin:4px;">
<a href="javascript:tag(':)', '')"><img src="/smiles/smile.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.сердит.', '')"><img src="/smiles/serdit.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.секрет.', '')"><img src="/smiles/secret.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.крут.', '')"><img src="/smiles/o4ki.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.миг.', '')"><img src="/smiles/mig.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.кисс.', '')"><img src="/smiles/kiss.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.глаза.', '')"><img src="/smiles/glaza.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':D', '')"><img src="/smiles/biggrin.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':(', "")"><img src="/smiles/bad.gif" alt="*" title="*"/></a>
<a href="javascript:tag('.че.', '')"><img src="/smiles/4e.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':зев', '')"><img src="/smiles/28a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':рад', '')"><img src="/smiles/51a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':сплю', '')"><img src="/smiles/46a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':люб', '')"><img src="/smiles/44a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':мечт', '')"><img src="/smiles/41b.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':фигасе', '')"><img src="/smiles/27a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':ах', '')"><img src="/smiles/26a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':язык', '')"><img src="/smiles/14a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':плак', '')"><img src="/smiles/13a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':лыба', '')"><img src="/smiles/11a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':злой', '')"><img src="/smiles/10a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':подмиг', '')"><img src="/smiles/09a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':сум', '')"><img src="/smiles/03a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':хмур', '')"><img src="/smiles/01.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':дум', '')"><img src="/smiles/07a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':грусть', '')"><img src="/smiles/06a.gif" alt="*" title="*"/></a>
<a href="javascript:tag(':улыбка', '')"><im