...

View Full Version : Variables and text fields



HIPPY
02-20-2007, 01:48 PM
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


<script> var numberofpoints = 24356 </script>

and I want that variable to be displayed in the body of the document



<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)

Mr J
02-20-2007, 03:12 PM
Do you mean the value assigned to the variable or the variable name itself?

HIPPY
02-20-2007, 04:00 PM
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

Mr J
02-20-2007, 07:34 PM
Put a div in the td cell

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

and in the script use

document.getElementById("mydiv").innerHTML=numberofpoints



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum