Jump to content

[SOLVED] this function has error on some servers???


Looktrne

Recommended Posts

this function works fine on one of my sites but won't work on a customers server

 

function emoticon(text)
{
if (document.post.message.createTextRange && document.post.message.caretPos)
{
	var caretPos = document.post.message.caretPos;
	caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == " " ? text + " " : text;
	document.post.message.focus();
}
else
{
	document.post.message.value  += text;
	document.post.message.focus();
}
}

 

is there any settings server side that might prevent this from working?

 

it enters a emoticon into a text field box...

 

here is how it is called

 

<script language="JavaScript" src="js/common.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
  	<td class="headline" colspan="3">Send Message</td>
  </tr>
  <tr>
    <td width="9%" valign="top"> 
      <p> </p>
      <table width="70" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#FFCD9B">
        <tr> 
          <td colspan="3"><div align="center"><font size="1"><strong>Emoticons</strong></font></div></td>
        </tr>
        <tr> 
          <td><img src="images/icon_smile.gif" width="15" height="15" onClick="emoticon(':-)');"></td>
          <td><img src="images/icon_biggrin.gif" width="15" height="15" onClick="emoticon(':-D');"></td>
          <td><img src="images/icon_sad.gif" width="15" height="15" onClick="emoticon(':-(');"></td>
        </tr>
        <tr> 
          <td><img src="images/icon_eek.gif" width="15" height="15" onClick="emoticon(':shock:');"></td>
          <td><img src="images/icon_mad.gif" width="15" height="15" onClick="emoticon(':-X');"></td>
          <td><img src="images/icon_cool.gif" width="15" height="15" onClick="emoticon('B-)');"></td>
        </tr>
        <tr> 
          <td><img src="images/icon_razz.gif" width="15" height="15" onClick="emoticon(':-P');"></td>
          <td><img src="images/icon_wink.gif" width="15" height="15" onClick="emoticon(';-)');"></td>
          <td><img src="images/icon_surprised.gif" width="15" height="15" onClick="emoticon(':-O');"></td>
        </tr>
      </table>
    </td>
    <td width="91%"><table width="100%" border="0" cellspacing="4" cellpadding="4" background="tn_811.jpg" bgcolor="#FFFFFF" align=center>
    	<table>
    		{FORM_ERRORS}
    		<tr>
          <td> <form action="index.php?page=send_message&action=send&profile_id=464" method=POST name="post">
              <table>
                <tr>
                  <td> 
                <tr> 
                  <td>To:</td>
                  <td> 
                  {SEND_MESSAGE_CONTENT}
                   </td>
                </tr>
                <tr> 
                  <td>Subject:</td>
                  <td><input type="text" name="subject" size="50" maxlength="50" value="{MSG_SUBJECT}" {INPUT_DISABLED}></td>
                </tr>
                <tr> 
                  <td valign=top>Message:</td>
                  <td><textarea name="message" rows="7" cols="40" {INPUT_DISABLED}>{MSG_BODY}</textarea></td>
                </tr>
                <tr> 
                  <td colspan=2 align=right><input name="submit" type="submit" value="Send Message" {INPUT_DISABLED}></td>
                </tr>
              </table>
            </form></td>
        </tr>
      </table>
      <br>
      </td>
  </tr>
</table>

 

any help with why this may not be working please let me know

 

Paul

when I use this function on my site it works

 

I click on a smiley face and it plants the text " :)  " into the text area of the message

 

when I click on the smiley face on my customers site with the same code. it does nothing nothing is put into the text box.

 

I also get an error object expected in internet explorer

 

Paul

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.