If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member echoSwe's Avatar
    Join Date
    May 2004
    Member #

    I'm a newbie at JavaScipt, who has always found what he needs on the net. I.e. nothing fancy :smoker:...
    What I would really appreciate to get helped with is a textarea tag.
    THe story goes that the unaware user comes lolling into my page and decides to send me an email. The problem is that both him and me are swedish, and use "special" signs such as , and .

    These signs need to be displayed in the message which is sent, but unfortunately the System.Web.Mail component of ASP .Net doesn't handle these "special" signs...

    Now, here is where the JavaScript comes into action... If I could somehow get help to write a script which loops through each sign in the textarea trying to find a special character, changing it to &aouml; and so on.

    What would this look like?

    Best wishes


  3. #2
    Senior Member
    Join Date
    May 2003
    Member #
    You split the string using a common delimeter (space) and you will be left with each letter/word, such as "hi i am bfsog" once I split it with a " ", result is:
    [0] => hi
    [1] => i
    [2] => am
    [3] => bfsog

    So, now you would loop through the length of the array, and compare each element in the array.

    Something like

    <script type="text/javascript">
    var i;
    var fullstring = document.formName.userInfo.value;
    var array = fullstring.split(" ");
    for(i = 0; i < array.length(); i++)
          if(array[i] == "character")
                 array[i] = "replacement character";

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search tags for this page

for loop textarea special characters


javascript loop through each letter of textarea

Click on a term to search for related topics.
All times are GMT -6. The time now is 06:35 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: