Hi everyone,

I'm working myself trough the code from the Ajax web application book.

coming to page 111 I wanted to try the code so far but it gives me
when I click the submit button:

"Object doesn't support this property or method."

can someone point what can trigger such error message?

this is the code (copied it from the book):
The debugger points me to line 103 (wich is: self.toggleEnabled(false); )
Code JavaScript:
var Login = new function()
{
 this.ajax = null;
 this.form = null;
 this.promptDiv = null;
 this.dotSpan = null;
 this.button = null;
 this.enabled = true;
 this.dots = '';
 this.promptInterval = null;
 
 this.cleanup = function()
 {
  var self = Login;
  self.form = null;
  self.promptDiv = null;
  self.dotSpan = null;
  self.button = null;
 };
 
 this.init = function()
 {
  var self = Login;
  self.ajax = new Ajax();
  self.form = document.getElementById('loginForm');
  self.promptDiv = document.getElementById('promptDiv');
  self.dotSpan = document.getElementById('dotSpan');
  self.button = document.getElementById('submitButton');
  self.setPrompt('base', 'Enter login ID & Password');
  self.form.LoginId.focus();
  self.toggleEnabled(false);
  self.form.onsubmit = function() {return false;}
  self.clearCookie('userId');
 };
 
 this.clearCookie = function(name)
 {
  var expireDate = new Date(0);
  document.cookie = name + '=; expires=' + expireDate.toGMTString() + '; path=/';
 };
 
 this.setPrompt = function(stat, msg)
 {
  var self = Login;
  var promptDiv = self.promptDiv;
  var msgSpan = document.getElementById('msgSpan');
  var statusClass = '';
  promptDiv.className = stat + 'Prompt'; // 'base' 'proc' 'err'
  if(msgSpan.firstChild)
  {msgSpan.removeChild(msgSpan.firstChild);}
  msgSpan.appendChild(document.createTextNode(msg));
 };
 
 this.keyup = function(e)
 {
  var self = Login;
  if(!e)
  {e = window.event;}
  if(e.keyCode != 13)
  {self.evalFormFieldState();}
  else
  {
   if(self.enabled)
   {self.submitData();}
  }
 };
 
 this.evalFormFieldState = function()
 {
  var self = Login;
  if(self.form.LoginId.value.length > 5 && self.form.Pass.value.length > 5)
  {self.toggleEnabled(true);}
  else
  {self.toggleEnabled(false);}
 };
 
 this.toggleEnabled = function(able)
 {
  var self = Login;
  if(able)
  {
   self.button.onclick = self.submitData;
   self.button.disabled = false;
   self.button.className = 'inputButtonActive';
   self.enabled = true;
  }
  else
  {
   self.button.onclick = null;
   self.button.disabled = true;
   self.button.className = 'inputButtonDisabled';
   self.enabled = false;
  }
 };
 
 this.submitData = function()
 {
  var self = Login;
  var postData = '';
  postData = formData2QueryString(self.form);
  self.ajax.doPost('php/applogin.php', postData, self.handleLoginResp);
  self.showStatusPrompt();
  self.toggleEnabled(false);
 };
 
 this.showStatusPrompt = function()
 {
  var self = Login;
  self.dots = '';
  self.setPrompt('proc', 'Processing');
  self.promptInterval = setInterval(self.showStatusDots, 200);
 };
 
 this.showStatusDots = function()
 {
  var self = Login;
  var dotSpan = self.dotSpan;
  self.dots += '.';
  if(self.dots.length > 4)
  {self.dots = '';}
  if(dotSpan.firstChild)
  {dotSpan.removeChild(dotSpan.firstChild);}
  dotSpan.appenChild(document.createTextNode(' ' + self.dots));
 };
 
 this.handleLoginResp = function(str)
 {
  var self = Login;
  var respArr = str.split(',');
  var respType = respArr[0].toLowerCase();
  var respMsg = respArr[1];
  if(respType == 'success')
  {location = respMsg;}
  else
  {self.showErrorPrompt(respMsg);}
 };
 
 this.showErrorPrompt = function(str)
 {
  var self = Login;
  var dotSpan = self.dotSpan;
  clearInterval(self.promptInterval);
  if(dotSpan.firstChild)
  {dotSpan.removeChild(dotSpan.firstChild);}
  self.setPrompt('err', str);
  self.form.LoginId.value = '';
  self.form.Pass.value = '';
  self.form.LoginId.focus();
 };
};
document.onkeyup = Login.keyup;
window.onload = Login.init;
window.onunload = Login.cleanup;

any help appreciated...

thx in advance,
Koen