0

Hello my friend out there i realy need help .i'm working on one of my class labs but things is not that write to me...could one out there assist me thanks you. here is the quz<<<<<< Write a program in HTML and JavaScript for the following tasks: Find the maximum number of entries in the three-digit number.<<<<< here is my code but its not that working well help!!

<html>
<body>
<form name="form1">
<script type="text/JavaScript">
<!--
function maxValue(x,y,z)
var x,y,z;
if(x>y)

<html>
<body>
<form name="form1">
<script type="text/JavaScript">
<!--
function maxValue(x,y,z)
var x,y,z;
if(x>y)
{
if(x>z)
{
"x-Maximum number";
}
else{
"z-Maximum number";
}}
else{
if(y>z)
{
"y-Maximum number";
}
else{
"z-Maximum number";
}}}
//-->
</script>
Enter the Number<input type="text" size =3 name="num"> <br>
<input type="button" value="Check the maximum number of" onClick="maxValue

(form1)"><br>
Result:<input type="text" size =75 name="res"><br>
<input type="reset">
</form>
</body>
</html>

Edited by JamesCherrill: Moved to correct forum javaSCRIPT!

2
Contributors
1
Reply
15
Views
2 Years
Discussion Span
Last Post by Taywin
0

Well, your script does neither read anything from the HTML element nor return/write the result to anything.

First, the script must read in the value of those 3 number. You have only 1 input field (name="num") which would not be enough with your current implementation. Next for simplisity, you should have 3 input fields with different id/name for now. Then look up "getElementById()" function or "$" symbol because this is the way you read in the data from the current HTML page you are working on. Then inside your if-else statements would be to print out the result by placing it inside your input field (name "res"). That's all...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.