Special Character to insert with JavaScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Streicher
    Senior Member
    • Jan 2001
    • 373
    • 3.7.x

    Special Character to insert with JavaScript

    I want to allow my user to insert special characters in the message field.

    For example: →

    I use the same JavaScript from the vBCode Smilies:

    function zeichen(thezeichen) {
    // inserts zeichen text
    document.vbform.message.value += thezeichen+" ";
    document.vbform.message.focus();
    }


    And for the clickable special character:

    <a href="javascript:zeichen('&rarr;')">&rarr;</a>

    When I click on the character it is inserted as an arrow not as HTML-Code into the messsage field. When i submit the message the arrow is replaced by: ©
    When I insert
    PHP Code:
    &rarr
    manually into the message field, it is displayed correctly after submitting.

    How can I fix the Problem? It is very important for me, because I have a scientific forum and not all of the user knows HTML.
    Streicher
  • Streicher
    Senior Member
    • Jan 2001
    • 373
    • 3.7.x

    #2
    *bump*
    Streicher

    Comment

    • Mike Sullivan
      Former vBulletin Developer
      • Apr 2000
      • 13327
      • 3.6.x

      #3
      AFAIK, there are known problems with meta characters in JS...

      Comment

      • Streicher
        Senior Member
        • Jan 2001
        • 373
        • 3.7.x

        #4
        hmm, ok. I have a last idea. I will test it...
        Streicher

        Comment

        • Streicher
          Senior Member
          • Jan 2001
          • 373
          • 3.7.x

          #5
          Yes it works now. I must go to more barbecues. I get good ideas there

          I will post in the hack forums soon.
          Streicher

          Comment

          • frank47
            Member
            • Jun 2003
            • 88

            #6
            I would really like to know how you worked this thing out cause I am trying to figure it out now!

            Thanx

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...