Results 1 to 2 of 2

Thread: Very simple script check...

  1. #1
    Join Date
    Sep 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Very simple script check...

    Hi I'm very new to all this stuff, so if someone could help I'd be most appreciative!

    I'm trying to write a test script that will get the number entered into a field and print it onscreen using identifiers - unfortunately the below doesn't work - can anyone point out where I'm being stupid - I've seen scripts using ["name_of_element"] to identify the exact part they want, but it doesn't work for me!

    <head>
    <script language="JavaScript">
    var main_variable = new Number();

    function printVariables()
    {
    document.write(document.["test"].value);
    }
    </script>
    </head>

    <body>
    <input type="text" name="test"><br>
    <input type="submit" value="Show Numbers" onClick="printVariables()">
    </body>

  2. #2
    Join Date
    Sep 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok I've given up on that method and I've got it 'sort of' working using getElementById - however it prints to a new page (ie my buttons/text boxes disappear - so I've tried to specify the location into a table at the bottom like below - but it still doesn't work - can anyone explain my stupidity?

    <head>
    <script language="JavaScript">
    var main_variable = new Number();

    function printVariables()
    {
    document.getElementById("main_app_gross_inc_show").write(document.getElementById("main_app_gross_inc").value);
    }
    </script>
    </head>

    <body>
    <input type="text" id="main_app_gross_inc"><br>
    <input type="submit" value="Show Numbers" onClick="printVariables()">

    <div>
    <table>
    <tr>
    <td id="main_app_gross_inc_show"></td>
    </tr>
    </table>
    </div>
    </body>
    Last edited by divtag33; 10-03-2006 at 12:36 PM.

Bookmarks

Posting Permissions

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