Results 1 to 2 of 2
  1. #1
    Hitsuin is offline Member
    Join Date
    Aug 2010
    Posts
    1
    Rep Power
    0

    Default Processing input - Very simple but I can't do it

    Hi Everyone, I'm new to this, you know the AnnoyAmeteur that reminds you of how smart you are. Well as much as I hate to be that guy that me right now. I need anyone who can to show me what I'm doing wrong and how to fix it.

    I want the 5th character input into this page to display differently. Also, if anyone can tell me why firefox keeps working on the page like its incomplete, which it probably is, but why, I'd really appreciate it.

    The code goes like this:

    ------------------------

    <html>
    <head>
    <script type="text/javascript">
    function show_prompt()
    {
    var code=prompt("Please enter your code");

    if ( code[4] = A ) { code[4] = S ; }
    if ( code[4] = B ) { code[4] = M ; }
    if ( code[4] = C ) { code[4] = I ; }
    if ( code[4] = D ) { code[4] = L ; }
    if ( code[4] = E ) { code[4] = E ; }


    document.write(code);
    document.write("<br />");
    }

    </script>
    </head>
    <body>

    <input type="button" onclick="show_prompt()" value="code" />

    </body>
    </html>

    ----------------------- OR ------------------

    <html>
    <head>
    <script type="text/javascript">
    function show_prompt()
    {
    var code=prompt("Please enter your code");

    if ( code[4] = 0 ) { code[4] = 9 ; }
    if ( code[4] = 1 ) { code[4] = 8 ; }
    if ( code[4] = 2 ) { code[4] = 7 ; }
    if ( code[4] = 3 ) { code[4] = 6 ; }
    if ( code[4] = 4 ) { code[4] = 5 ; }


    document.write(code);
    document.write("<br />");
    }

    </script>
    </head>
    <body>

    <input type="button" onclick="show_prompt()" value="code" />

    </body>
    </html>
    -------------------------------

    The second one goes farther but not all the way, please help me out.

    Thanks for reading.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Your question is a JavaScript question and this is a Java forum -- two very different beasts. Your best bet is to google for a JavaScript forum and ask your question there. Since this question is off topic, I am locking it and will delete it later. Much luck.

Similar Threads

  1. Replies: 3
    Last Post: 08-07-2010, 05:28 AM
  2. Processing help
    By menez in forum Java Applets
    Replies: 3
    Last Post: 02-23-2010, 02:13 AM
  3. Input technique for unknown lines of input
    By ducreative in forum New To Java
    Replies: 16
    Last Post: 09-23-2009, 09:26 AM
  4. Scanner Issues (User Input: Very Simple)
    By carlodelmundo in forum New To Java
    Replies: 8
    Last Post: 10-31-2008, 02:44 AM
  5. how to take input and verify input in Java programs
    By bilal_ali_java in forum Advanced Java
    Replies: 0
    Last Post: 07-21-2007, 08:46 AM

Posting Permissions

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