...

View Full Version : Simple variables



HIPPY
06-11-2007, 04:18 PM
I have dumbed this down quite alot but the basic principle of my problem is still there.


<script>
function tournypoints()
{
var tp = 200 - 100;
document.getElementById("tp2").innerHTML=tp
}
</script>
<body>
<div id="tp2"></div>
</body>

I want the reuslt of 200-100 to appear in the body in between the div tags, although this does not happen.

Can someone tell me what i have missed or an alternative/better way of doing this.

glenngv
06-11-2007, 04:52 PM
You are not calling tournypoints() onload.

<body onload="tournypoints()">

HIPPY
06-11-2007, 05:05 PM
<body onload="opener.autosize(window)"> i already have that code in the body tags.. how do i add <body onload="tournypoints()"> also?

glenngv
06-11-2007, 05:09 PM
Separate them with semicolon.

<body onload="opener.autosize(window); tournypoints()">

HIPPY
06-11-2007, 05:17 PM
thank you very much

how do you round numbers?

glenngv
06-11-2007, 05:25 PM
Math.round(theNumber)
More info here (http://devguru.com/technologies/javascript/10756.asp).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum