Whats wrong with my javascript?

Joined
Jun 17, 2005
Messages
3
Reaction score
0
Code:
<script language="javascript">
function createHTTPObject {
   var httpObj = null;
   if (window.XMLHttpRequest) {
      httpObj = new XMLHttpRequest();
   } else if (window.ActiveXObject) {
      httpObj = new ActiveXObject("Microsoft.XMLHttp");
   }
   if (httpObj) {
      httpObj.onReadyStateChange = function() {
         if (httpObj.readyState == 4) {
            //processCommand(httpObj.responseText);
         }
      };
   }
   if (httpObj != null) {
      return httpObj;
   } else {
      return false;
   }
}
		
function getObject(objectId) {
   if(document.getElementById && document.getElementById(objectId)) {
      return document.getElementById(objectId);
   } else if (document.all && document.all(objectId)) {
      return document.all(objectId);
   } else if (document.layers && document.layers[objectId]) {
      return document.layers[objectId];
   } else {
      return false;
   }
}
			
function setLayer(layerID, display) {
   layerObj = getObject(layerID);
   if (layerObj) {
      layerObj.style.display = display;
      return true;
   } else {
      return false;
   }
}
</script>

Hey guys, got a problem which is bugging the hell out of me. With the createHTTPObject function present, I get an 'Object expected' error everytime I call any javascript functions, but with it not in there, it doesn't happen, this makes it quite apparent that there is something wrong in my createHTTPObject function, but for the life of me, I can figure it out!

Any takers?
 
Joined
Jul 7, 2005
Messages
25
Reaction score
0
function createHTTPObject() {

instead of:

function createHTTPObject {

???

not a clue if that helps ... don't kill the messenger if i'm not even close ... don't know anything about java man, just playin around with it and the error disappeared

A.
 
Joined
Jun 17, 2005
Messages
3
Reaction score
0
oilnetcom said:
function createHTTPObject() {

instead of:

function createHTTPObject {

???

not a clue if that helps ... don't kill the messenger if i'm not even close ... don't know anything about java man, just playin around with it and the error disappeared

A.


Your bloody right as well! How did I not see that sooner???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top