Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a typewriter javascript.

Status
Not open for further replies.

Ghargoil

Programmer
Feb 12, 2001
1
US
Hey, anyone know where I can find a good typewriter javascript app?
I found one, but its only for 1 line, and it doesnt support HTML- and I'm currently not advanced enough to actually modify it to work with HTML.

The other one works with HTML, and shows on the site, but when I use the same source code on my own computer, it refuses to work.

Typewriter 1: (The one that doesn support HTML)
Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 3.2//EN&quot;>
<html>
<head>
<title>Loading</title>

<meta name=&quot;GENERATOR&quot; content=&quot;Namo WebEditor v4.0&quot;>
</head>
<body face=&quot;Stencil&quot; bgcolor=&quot;black&quot; text=&quot;lime&quot; link=&quot;lime&quot; vlink=&quot;lime&quot; alink=&quot;lime&quot;>
<p id='anima' style=&quot;font-family:System,sans-serif; font-size:12pt; background-color:black; position:absolute; foreground-color:green;&quot;>
<font color=&quot;lime&quot;>
&amp;nbsp;</font></p>
<p style=&quot;font-family:System,sans-serif; font-size:12pt;&quot;><font color=&quot;lime&quot;><br>
<br>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
text = &quot;Loading--------------------------------------100%&quot;
word = text.split('.')
i = -1;           //letter count
j = 0;            //which word in array is to be spelled
start = 0;      //variable to hold cycles of the blink
scount = 0;  //variable to hold cycles of the mispell
function checkIt() {
with(document.all.anima) {
if(innerText.charAt(innerText.length-1) == &quot;_&quot;) {
innerText = innerText.substring(0, innerText.length - 1);
return true;
}
else {
innerText = innerText + &quot;_&quot;;
return false;
      }
   }
}
function blinkfor(count, timing) {
with(document.all.anima) {
if(start < count) {
if(checkIt()) {
start++;
}
mistake = 'blinkfor('+count+','+timing+')';
setTimeout('eval(mistake)', timing);
}
else {
start = 0;
i++;
call_It();
      }
   }
}
function mispell(offset,correction) {
with(document.all.anima) {
if(scount < offset) {
if(!checkIt()) {
innerText = innerText.substring(0, innerText.length-2) + &quot;_&quot;;
scount++;
}
mistake = 'mispell(' + offset + ', &quot;' + correction + '&quot;)';
setTimeout(&quot;eval(mistake)&quot;, 150);
}
else {
if(correction == '' &amp;&amp; scount == offset ) {
i = i - offset;
scount++;
}
if(offset > 0) {
if(checkIt()) {
innerText += correction.charAt(correction.length - offset) + &quot;_&quot;;
offset--;
}
mistake = 'mispell(' + offset + ',&quot;' + correction + '&quot;)';
setTimeout(&quot;eval(mistake)&quot;, 150);
}
else {
scount = 0;
j++;
innerText = innerText.substring(0, innerText.length - 1);
call_It();
         }
      }
   }
}
function spellit(string) {
with(document.all.anima) {
if(i <= string.length) {
if(string.charAt(i) == '/') {
NumErrs = string.charAt(i + 1);
NewLets = string.substring(i + 2, i + NumErrs);
mispell(NumErrs,NewLets);
}
else if(i <= string.length - 1) {
i++;
innerText = string.substring(0,i) + &quot;_&quot;;
mistake = 'spellit(&quot;' + string + '&quot;)';
setTimeout(&quot;eval(mistake)&quot;, 150);
}
else {
innerText = string.substring(0, i);
j++;
call_It();
         }
      }
   }
}
function call_It() {
with(document.all) {
if(i == -1){
blinkfor(4, 150);
}
else if(j <= word.length - 1) {
spellit(anima.innerText + &quot; &quot; + word[j]);
} 
else {
blinkfor(100,230);
      }
   }
}
if(document.all) {
call_It();
}
</script>
</font></body>
</html>

The other one (from my friends site) is like this:
Code:
<html>

<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>





<title>[Silent Thunder] members area</title>

<!--[ HEAD ::Java-SCRIPTS:: By Paul Crabtree aka AbomiNation ]-->
<SCRIPT LANGUAGE=JavaScript>

var strText = &quot;&quot;;   

function showtext(i) {
    var HTMLtag = 0;    
    
    for (count=4; i < strText.length &amp;&amp; count > 2; i++) {
        if (strText.charAt(i) == &quot;<&quot; || strText.charAt(i) == &quot;>&quot;) HTMLtag = !HTMLtag;
        if (!HTMLtag) count--;
    }

    document.all[&quot;grim&quot;].innerHTML = strText.substr(0, i);
    
    if (i < strText.length) setTimeout(&quot;showtext(&quot; + i + &quot;)&quot;, 20);
}

function fart() {
    strText = document.all[&quot;grim&quot;].innerHTML;
    document.all[&quot;grim&quot;].innerHTML = &quot;&quot;;
    document.all[&quot;grim&quot;].style.visibility = &quot;visible&quot;;
    setTimeout(&quot;showtext(0)&quot;, 100);
}

</SCRIPT>
<!--:[ END OF ME J-Scripts ]:-->


</head>

<body bgcolor=&quot;#000000&quot; ONLOAD=&quot;fart()&quot;>



<div align=&quot;center&quot;>
  <center>
  <table border=&quot;1&quot; width=&quot;40%&quot; bordercolor=&quot;#808080&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#666666&quot; height=&quot;123&quot;>
    <tr>
      <td width=&quot;100%&quot; height=&quot;117&quot;>
      
      <script Language=&quot;JavaScript&quot;>
      
      function password (pass) {
      
      var password = ''
      
      if (password != null){
      location.href= pass + &quot;.htm&quot;;
      
      }
      
      }
</script>


<form name=&quot;login&quot;>
<FONT COLOR=black ID=grim STYLE=&quot;visibility:hidden&quot;>
  <FONT FACE=&quot;Verdana&quot; SIZE=2>
    <FONT COLOR=&quot;#000000&quot;>
    <center>
    Hello.<P> If your a member and you do not have a Passcode yet, [-<A HREF=&quot;mailto:vad000@att.net&quot;>E-mail me</A>-]<P>
    A...
      </center>
      <P>
      <hr>
   </FONT>
 </FONT>
</FONT>

  <hr>
  <p align=&quot;center&quot;><font color=&quot;#000000&quot;>]-:-Enter password-:-[</font><br>
  <br><center>
    <input NAME=&quot;pass&quot; size=&quot;20&quot; type=&quot;password&quot;><br>
  <input TYPE=&quot;button&quot;
  VALUE=&quot;::Press to Login::&quot; onClick=&quot;password(form.pass.value)&quot;>
  </center>
  </p>
  <div align=&quot;left&quot;>
    <hr>
  <div align=&quot;left&quot;>
    <hr>
  </div>
  </div>
</form>
</td>
    </tr>
  </table>
</div>
</body>

</html>
<!-- text below generated by server. PLEASE REMOVE --></table></script></style></noscript>
<script language=&quot;JavaScript&quot; src=&quot;[URL unfurl="true"]http://us.geo1.yimg.com/us.geocities.com/js_source/ygIELib8.js&quot;></script><script[/URL] language=&quot;JavaScript&quot;>var yviContents='[URL unfurl="true"]http://us.toto.geo.yahoo.com/toto?s=76001072&amp;l=NE&amp;b=1&amp;t=982004612';</script></script><script[/URL] language=&quot;JavaScript&quot;>yviR='us';yfiEA(0);</script></script><script language=&quot;JavaScript&quot; src=&quot;[URL unfurl="true"]http://us.geo1.yimg.com/www.geocities.com/js_source/geov2.js&quot;></script><script[/URL] language=&quot;javascript&quot;>geovisit();</script><noscript><img src=&quot;[URL unfurl="true"]http://visit.geocities.com/visit.gif&quot;[/URL] border=0 width=1 height=1></noscript>
<IMG SRC=&quot;[URL unfurl="true"]http://geo.yahoo.com/serv?s=76000424&amp;t=982004612&quot;[/URL] ALT=1 WIDTH=1 HEIGHT=1>
Thx for all the help guys (and girls!)!
s-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top