# Can't find the error

**URL:** <https://forum.kirupa.com/t/cant-find-the-error/260270>\
**Category:** Uncategorized\
**Created:** [May 14, 2008, 1:03am UTC](https://forum.kirupa.com/t/cant-find-the-error/260270 "2008-05-14T01:03:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![masterxox](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@masterxox](https://forum.kirupa.com/u/masterxox)\
**Post date:** [May 14, 2008, 1:03am UTC](https://forum.kirupa.com/t/cant-find-the-error/260270/1 "2008-05-14T01:03:14Z")

</div>

\<?xml version =“1.0”?\>  
\<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”  
“[http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd](http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd)”\>

\<!-- Fig. 7.6: welcome5.html–\>  
\<!— Using Promt Boxes --\>

\<html xmlns =“[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)”\>

\<head\>

\<title\> 10 points for MOHAMMAD REZZA && PASS THE TEST55+10=65\</title\>

\<script type=“text/javascript”\>

\<!–

var x,y,z,o,p,maxValue,minValue;  
var xVal, yVal, zVal, oVal, pVal;

// read the name from the prompt box as a string  
xVal = window.prompt(“please enter your first integer”, “0”);  
yVal = window.prompt(“please enter your second integer”, “0”);  
zVal = window.prompt(“please enter your first integer”, “0”);  
oVal = window.prompt(“please enter your first integer”, “0”);  
pVal = window.prompt(“please enter your first integer”, “0”);

x=parseInt (xVal);  
document.writeln("\<br/\>First number is: " +x);  
y=parseInt (yVal);  
document.writeln("\<br/\>Second number is: " +y);  
z=parseInt (zVal);  
document.writeln("\<br/\>Third number is: " +z);  
o=parseInt (oVal);  
document.writeln("\<br/\>Fourth number is: " +o);  
p=parseInt (pVal);  
document.writeln("\<br/\>Fifth number is: " +p);

{  
var maxValue;  
if (x\>y)  
{  
maxValue =x ;  
}  
else  
{  
maxValue = y;  
}  
if (y\>z)  
{  
maxValue =y ;  
}  
else  
{  
maxValue = z;  
}  
if (z\>o)  
{  
maxvalue =z;  
}  
else  
{  
maxValue = o;  
}  
if (o\>p)  
{  
maxvalue =o;  
}  
else  
{  
maxValue = p;  
}

```
{
    document.writeln("&lt;br/&gt;The MAXIMUM number is: " +maxValue);
}

```

}

{  
var minValue;  
if (x\<y)  
{  
minValue =x ;  
}  
else  
{  
minValue = y;  
}  
if (y\<z)  
{  
minValue =y ;  
}  
else  
{  
minValue = z;  
}  
if (z\<o)  
{  
minValue =z;  
}  
else  
{  
minValue = o;  
}  
if (o\<p)  
{  
minValue =o;  
}  
else  
{  
minValue = p;  
}

```
{
    document.writeln("&lt;br/&gt;The MInImum number is: " +minValue);
}

```

}

//–\>

\</script\>

\</head\>

\<body\>  
\<p\> click Refresh to run this script again.\</p\>  
\</body\>

\</html\>

---

<div class="post-metadata">

**Author:** ![Templarian](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/templarian/32/7152_2.png) [@Templarian](https://forum.kirupa.com/u/Templarian)\
**Post date:** [May 14, 2008, 2:00am UTC](https://forum.kirupa.com/t/cant-find-the-error/260270/2 "2008-05-14T02:00:04Z")

</div>

Use firebug to debug it. What it suppose to do.

Right now your writing outside of the body so it won’t be visible.

---

<div class="post-metadata">

**Author:** ![borrob](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@borrob](https://forum.kirupa.com/u/borrob)\
**Post date:** [May 14, 2008, 7:56am UTC](https://forum.kirupa.com/t/cant-find-the-error/260270/3 "2008-05-14T07:56:46Z")

</div>

rewrote your code a little:

```auto

<?xml version ="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<!-- Fig. 7.6: welcome5.html-->
<!--- Using Promt Boxes -->

<html xmlns ="http://www.w3.org/1999/xhtml">

<head>

<title> 10 points for MOHAMMAD REZZA && PASS THE TEST55+10=65</title>

<script type="text/javascript">

<!--

var x,y,z,o,p,maxValue,minValue;
var xVal, yVal, zVal, oVal, pVal; 

var value_arr = new Array();

// read the name from the prompt box as a string
xVal = window.prompt("please enter your first integer", "0");
yVal = window.prompt("please enter your second integer", "0");
zVal = window.prompt("please enter your first integer", "0");
oVal = window.prompt("please enter your first integer", "0");
pVal = window.prompt("please enter your first integer", "0");

value_arr[0]=parseInt (xVal);
document.writeln("<br/>First number is: " + value_arr[0] );
value_arr[1]=parseInt (yVal);
document.writeln("<br/>Second number is: " + value_arr[1] );
value_arr[2]=parseInt (zVal);
document.writeln("<br/>Third number is: " + value_arr[2] );
value_arr[3]=parseInt (oVal);
document.writeln("<br/>Fourth number is: " + value_arr[3] );
value_arr[4]=parseInt (pVal);
document.writeln("<br/>Fifth number is: " + value_arr[4] );

function get_minimum( arr )
{
    var minimum = 0;
    if( arr.length == 0 )
    {
        return minimum;
    }
    minimum = arr[0];
    for( i = 0; i < arr.length; i++ )
    {
        if( arr* < minimum )
        {
            minimum = arr*;
        }
    }
    return minimum;    
}

function get_maximum( arr )
{
    var maximum = 0;
    if( arr.length == 0 )
    {
        return maximum;
    }
    maximum = arr[0];
    for( i = 0; i < arr.length; i++ )
    {
        if( arr* > maximum )
        {
            maximum = arr*;
        }
    }
    return maximum;    
}
document.writeln("<br/>The maximum number is: " + get_maximum( value_arr ) );
document.writeln("<br/>The minimum number is: " + get_minimum( value_arr ) );

//-->
</script>
</head>
<body> 
<p> click Refresh to run this script again.</p>
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![jkanakaraj](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@jkanakaraj](https://forum.kirupa.com/u/jkanakaraj)\
**Post date:** [May 16, 2008, 7:01am UTC](https://forum.kirupa.com/t/cant-find-the-error/260270/4 "2008-05-16T07:01:09Z")

</div>

The above method is much cleaner - really no reason to not loop the function.
