quick bit of help

Soldato
Joined
28 Jul 2003
Posts
4,074
Location
Hook
right i have done most the work so i think this is allowed.
i have made a program in javascript. that when u input the temperature of the water it will tell you if its a liquid, gas or solid.
but i cant get it to work with negative temperatures. any idea why?

Code:
<HTML>
<HEAD>
<TITLE> Temperature program
</TITLE>
<SCRIPT LANGUAGE = "JavaScript">


// A program for determining the state of water

theTemperature = 0;
state = 'ice';
theTemperature = window.prompt('what is the temperature?', '');

if ( theTemperature  < 0 ) state = ('ICE');
if ( theTemperature  > 0 <= 100) state = ('LIQUID');
if ( theTemperature  > 100) state = ('GAS');


document.write ( 'The water is : ', state );
document.write ( '<BR>' + 'Thank-you for using this program.');
document.close ();

</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>


thanks.
 
Back
Top Bottom