HomeSoftwareScriptsNotesToolboxGallery
Scripts
2D Rotation (JS)3D Rotation (JS)Ping Flood (CMD)Self Signed CertPHP Database InterfaceAutoWrite (JS)Digitize Text (JS)GrafJS (JS)Image Animation (JS)ASCII Loading Indicator (JS)Div Layer Movement (JS)Div Layer Resizing (JS)Text Scrolling (JS)Statistics Graph (PHP)Turn off AAM/APM (BAT)RW Protect (BAT)SRT Renamer (PHP)String Encryption (PHP)Windows WiFi Hotspot (BAT)YouTube DL Script (BAT)

AutoWrite with JavaScript


Automatic writing with JavaScript. Code and working example below.

Code:
Example Usage:
==============
- HTML: <div id="AutoText1" style="display:none">
          <span id="AutoText1_txt"></span>
          <span id="AutoText1_cur">_</span>
        </div>
  - JS: document.getElementById('AutoText1').style.display = 'block';
        setTimeout("WriteMsg('AutoText1_txt', '"+ WriteText1 +"')", WriteSpeed);
        setInterval("ShowCursor('AutoText1_cur')", CursorSpeed);
*/

// Configuration.
var CursorSpeed = 500;
var CursorActive = false;
var WriteSpeed = 50;
var WriteText1 = ""+
	"Thronic.com is a pure back-end for private development and services. "+
	"Feel free to send me an e-mail on the address above if you want to reach me.[BR][BR]"+
	"Have a nice day![BR][BR]"+
	":)";

// void ShowCursor(string elem);
function ShowCursor(elem) {
	var cur = document.getElementById(elem).style;
	if (cur.visibility == 'visible')
		cur.visibility = 'hidden';
	else
		cur.visibility = 'visible';
}

// WriteMsg(string elem, string msg);
function WriteMsg(elem, msg) {
	if (msg != '') {
		var msg_arr = msg.split('');
		var WritePause = 0;
		var NextVal = msg_arr.shift();
		var docElem = document.getElementById(elem);
		
		docElem.innerHTML += NextVal;
		msg = msg_arr.join('');
		WritePause = 0;
		
		while (msg.substr(0,4) == '[BR]') {
			docElem.innerHTML += '<br>';
			msg = msg.substr(4);
			WritePause = 1000;
		}
		
		if (NextVal == '.' || NextVal == '?' || NextVal == '!' || NextVal == ',') {
			if (msg.substr(0,1) == ' ')
				WritePause = 1000;
		}
		
		setTimeout("WriteMsg('"+elem+"','"+msg+"')",WriteSpeed+WritePause);
	}
}

Click on me for a working example!
_