Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2008
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How to write on the same page?

    Hi, I wanted to now the method for how to write a value in on a same page without losing all the rest of the page. IN the cas of my script it should bee in the "r" box.

    {code}
    <html>
    <head>

    <title>Calcul de force électrique </title>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function Calculator(){

    var a=document.calculator.a.value;

    var b=document.calculator.b.value;

    var aq=b*b;

    document.write(aq) ON THE SAME PAGE IN "R" BOX??

    }
    // End -->
    </SCRIPT>



    </head>
    <body>
    <div id="main">
    <form name=calculator>

    <br><br>±
    <input name="a">
    <input name="b">




    <br><br><br>
    <input name="r"> result

    <input type="button" value="Go!" onClick="Calculator()">

    </form>
    </body>
    </html>
    {/code}



    Thanks for your help.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Replace

    document.write(aq)

    with

    document.calculator.r.value=aq
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • Users who have thanked Mr J for this post:

    timothymarvel (09-10-2008)


  •  

    Posting Permissions

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