I am a newbie to java and i dont understand why i am recieving an error saying that the "weight is undefined" on line 8
could anyone help?
<HTML>
<HEAD>Egg Sizes
<TITLE>A program for classifying eggs by size var weight</TITLE>
<SCRIPT LANGUAGE="JavaScript"
type="text/javascript">
// The weight of the egg weight = window.prompt('Please enter the weight of the egg in grams','');
document.write('The weight of the egg is ' + weight + ' g.');// Confirming the input //
if('The weight of the egg < 53g')
{
document.write('It is a Small egg.')
}
else
{
if('The weight of the egg 53g < 63g')
{
document.write('It is a Medium egg.')
}
else
{
if('The weight of the egg 63g < 73g')
{
document.write('It is a Large egg.')
}
else
{
if('The weight of the egg > 73g')
{
document.write('It is a Very large egg.')
}
}
}
document.write('Thank you for using this program.');
}
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
could anyone help?
<HTML>
<HEAD>Egg Sizes
<TITLE>A program for classifying eggs by size var weight</TITLE>
<SCRIPT LANGUAGE="JavaScript"
type="text/javascript">
// The weight of the egg weight = window.prompt('Please enter the weight of the egg in grams','');
document.write('The weight of the egg is ' + weight + ' g.');// Confirming the input //
if('The weight of the egg < 53g')
{
document.write('It is a Small egg.')
}
else
{
if('The weight of the egg 53g < 63g')
{
document.write('It is a Medium egg.')
}
else
{
if('The weight of the egg 63g < 73g')
{
document.write('It is a Large egg.')
}
else
{
if('The weight of the egg > 73g')
{
document.write('It is a Very large egg.')
}
}
}
document.write('Thank you for using this program.');
}
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>