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 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Variables and text fields

    Here is a simplified version of what script I need for my site..

    Want I want to do is have a variable and then be able to put it into an ordinary text field... so for examplein the head it says

    Code:
     <script> var numberofpoints = 24356 </script>
    and I want that variable to be displayed in the body of the document

    Code:
    <td>
    <b>Coin Points:</b>
    </td>
     <td>5644</td>
     </tr>
    
     <tr>
     <td>
    <b>Points:</b>
    </td>
     <td>{var numberofpoints goes in here}</td>
     </tr>
    I know that this is a very nooby question, but I only have a very basic understanding of JS and things are easily confused for me right now

    Thanks for your help in advance

    (also i dont want it in an input field, i'd prefer it to look like normal static text)

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Do you mean the value assigned to the variable or the variable name itself?
    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.

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the value assinged to the variable i want displayed... in reality there is a code that retrieves information from the server on what that value is ....

    how would get the value assigned to the variable to be displayed as normal text where i indicated

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Put a div in the td cell

    <div id="mydiv"></div>

    and in the script use

    document.getElementById("mydiv").innerHTML=numberofpoints
    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.


  •  

    Posting Permissions

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