JavaScript Help

Cynical

Active Member
Messages
3,492
Reaction score
0
Points
36
I found a snippet of JS code on some website and I'm trying to mold it into something I can use. Unfortuntely, only half the script works. The script is supposed to count 1... 2... 3... etc. (at least for now, I have other intentions later), but it returns an error in IE (stops in Opera) when switching from 2 to 3. IE says "Object expected" on line 1 character 1. Here's the code for the entire page:
Code:
<SCRIPT LANGUAGE="JavaScript">
<!--

function makeArray(q) {
  for (i=1; i < q; i++) {
    this[i]=0
  }
}
w = 1;
count = 4;

txt = new makeArray(count);
wait = new makeArray(count);

txt[1] = "1";
txt[2] = "2";
txt[3] = "3";
txt[4] = "4";
wait[1] = 1000;
wait[2] = 1000;
wait[3] = 1000;
wait[4] = 1000;

function showSites() {
  if (w > count) {
     w = 1;
  };
  var string = txt[w];

  document.write(string);
  window.setTimeout('showSites()',wait[w]);
  w += 1;
}

// End -->
</SCRIPT>
</head>

<BODY>
<script>
showSites();
</script>
Any help getting it to work would be greatly appreciated... I hardly know any javascript myself.

EDIT: Solved, it was an array issue.
 
Last edited:
Top