Javascript help - escaping special characters

Discussion in 'JavaScript' started by x135, Oct 23, 2008.

  1. #1
    Hi all,

    I desperately need some help with some JavaScripting, what I'm trying to do is:

    Escape all special characters out of tab separated data that is stored in a text file.

    Any suggestions asap would be most appreciated!

    ta
     
    x135, Oct 23, 2008 IP
  2. salahsoftware

    salahsoftware Peon

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this may help:

    <script language="JavaScript">
    <!--
    for(var count=32; count<=254; count++)
    {

    document.write("&amp;#");
    document.write(count + "; = ");
    document.write("&#" + count + ";");
    document.write("<br>");

    }
    // -->
    </script>

    and this is a tested solution
    <!-- Begin
    function processForm(form) {
    var nickname = form.nickname.value;
    var password = form.password.value;

    nickname = escape(nickname);
    password = escape(password);

    window.location = window.location + "?nickname=" + nickname + "&password=" + password;
    }
    // End -->
    </script>
    <BODY>

    <center>
    <form action="">
    <tt><pre>
    Nickname: <input type=text name=nickname value="" size=10>
    Password: <input type=text name=password value="" size=10>

    <input type=button value="Submit!" onClick="javascript:processForm(this.form);">
    </pre></tt>
    </form>
    </center>
     
    salahsoftware, Oct 24, 2008 IP