When I enter the integer, I'm not getting the prompt that states if it is odd or even. I am new to this, so this stupid thing has taken me a week to do, but now I am just frustrated. Can someone help me out.

<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	
<!-- Fig. 6.9: addition.html -->
<!-- Addition script. -->
<html xmlns = "http://www.w3.org/1999/xhtml">

<head>
      <title>Odd or Even</title>

      <script type = "text/javascript">
 <!--

// Determine if number is odd or even
Function OddEven(number)   

 // convert number from type string to type Int 
         x = Integer.parseInt ( xNumber );        
if ( x % 2 == 0 ) 
if ( x % 2 != 0 )
         // display odd or even integer
         document.writeln( 
            "<h1>Integer is "odd or even"</h1>" );
End If
End Function

// Convert input to long integers
Sub CmdButton_OnClick()
Dim number
number=CLng(Document.forms(0).n1.Value)
 

Call OddEven(number)
End Sub
// -->
</script>
</head>

<body>
<form name="form1" id="form1" method="post" action="">
<p>
<input type="text" name="n1" />
Enter a number greater than 0</p>
<p>
<input type="submit" name="CmdButton" value="Compute" />
</p>
<p>
<input type="reset" name="Reset" value="Reset" />
</p>
</form>
</body>
</html>

You could try this, if you are referring the whole thing in Javascript:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml-stylesheet type="text/css" href="#css21" media="screen"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html id="xhtml10S" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Window-Target" content="_top" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Free Live Help!</title>
<style id="css21" type="text/css" media="screen">
/* <![CDATA[ */

/* ]]> */
</style> 
<script type = "text/javascript">
<!--

var OddEven = function( number ) {
var alertMessage;
var x = number.n1.value * 1;
   if (( x % 2 ) === 0 ) {
     alertMessage = "Even";
   } else { 
   alertMessage = "Odd";
   } if ( number.n1.value !== "" ) {
   document.writeln(
"<h1>This ( " + x + " ) Integer is an " + alertMessage + " number</h1>" ); 
   } return false;
};

// -->
</script>
</head>
<body>
<div id="main">
<form id="form1" method="post" action="#" onsubmit="return OddEven( this );">
<div>
<p>
<input type="text" id="n1" name="n1" value="" />Enter a number greater than 0</p>

<p><input type="submit" name="CmdButton" value="Compute" />
</p>
<p>
<input type="reset" name="Reset" value="Reset" /></p>
</div>

</form>
</div>
</body>
</html>

essential

Sorry, what about:

<input type=text onChange="alert((this.value % 2)==0 ? 'even' : 'odd' );">

:-/

This question has already been answered. Start a new discussion instead.