var x = 0; var position = 0; var slength = thetext[0].length; var writestr = ''; // the calculated speed between each character var interval = 0; // this value is 1 if text is beign dealt with and 0 if a tag is being dealt with var torc = 1; // this holds the string if a tag is being dealt with // n.b. if a tag is being dealt with, it is not written to the screen until the complete tag is read var buildstr = ''; // function to ignore errors function myerror() { return true; } // draws the start text for a page function draw_head() { headstr = '
'); // scroll to the end of the page tickwin.scrollTo(0, tickwin.screen.availHeight); // re-iterate setTimeout("textticker()", lspeed); } // if at the end of the message if(++x == max) { // set the counter to 0 x = 0; // draw the end of the page draw_end(); //close and open the window (needed for some browsers) tickwin.document.close(); tickwin.document.open(); // draw the head text draw_head(); } //Set slength to the length of the new string slength = thetext[x].length; } else // if not at the end of the string { // if the window hasn't been closed if (!tickwin.closed) { //scroll to the end of the window tickwin.scrollTo(0, tickwin.screen.availHeight); // calculate a random interval interval = (Math.round(Math.random() * rspeed) + fspeed); // if writing text if (torc == 1) { // if ending a tag (torc changed over when writestr=='>') if (writestr=='>') { // complete the buildstring (tag) buildstr = buildstr + writestr; // write the entire buildstring (tag) to the window tickwin.document.write(buildstr); // Set the buildstring to ''; buildstr = ''; //re-iterate textticker(); } else // if not ending a tag { // if the character is a space if (writestr == ' ') { // then write a space (again, some browsers need this) tickwin.document.write(' '); } else { // else write the character tickwin.document.write(writestr); } // re-iterate setTimeout("textticker()", interval); } } else // if writing a tag { // add to the buildstring buildstr = buildstr + writestr; // re-iterate textticker(); } } } } //start the proccess var winstr = 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ',scrollbars=' + scrollbars + ',status=' + status + ',toolbar=' + toolbar + ',location=' + location + ',menubar=' + menubar + ',directories=' + directories; var tickwin = window.open('', '', winstr); // negate errors tickwin.onerror = myerror; if (!tickwin.closed) { draw_head(); } textticker(); Senior Senator John McCain of AZ to bolt from the GOP? Meeting this weekend in AZ with Dem Majority Leader Tom Daschle
The News ticker window should open up automatically