<br />
<style type="text/css">
body{
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
margin-top:0px;
background-repeat:no-repeat;
padding-top:1px;
}
#myContent, #myContent blink{
width:100%px;
height:100%px;
background:black;
color: #00FF00;
font-family:courier;
}
blink{
display:inline;
}
</style><br />
<script type="text/javascript">
var charIndex = -1;
var stringLength = 0;
var inputText;
function writeContent(init){
if(init){
inputText = document.getElementById('contentToWrite').innerHTML;
}
if(charIndex==-1){
charIndex = 0;
stringLength = inputText.length;
}
var initString = document.getElementById('myContent').innerHTML;
initString = initString.replace(/<SPAN.*$/gi,"");
var theChar = inputText.charAt(charIndex);
var nextFourChars = inputText.substr(charIndex,4);
if(nextFourChars=='<br>' || nextFourChars=='<br>'){
theChar = '<br>';
charIndex+=3;
}
initString = initString + theChar + "<span id='blink'>_</SPAN>";
document.getElementById('myContent').innerHTML = initString;
charIndex = charIndex/1 +1;
if(charIndex%2==1){
document.getElementById('blink').style.display='none';
}else{
document.getElementById('blink').style.display='inline';
}
if(charIndex<=stringLength){
setTimeout('writeContent(false)',10);
}else{
blinkSpan();
}
}
var currentStyle = 'inline';
function blinkSpan(){
if(currentStyle=='inline'){
currentStyle='none';
}else{
currentStyle='inline';
}
document.getElementById('blink').style.display = currentStyle;
setTimeout('blinkSpan()',500);
}
</script>
<div id="myContent">
</div>
<div id="contentToWrite" style="display:none">
TULISAN ANDA <br />
1. No Smoking, No Die <br />
2. No Women, No Cry <br />
3. No Watch, No Brook<br />
4. No Money, No Dong<br />
</div>
<script type="text/javascript">
writeContent(true);
</script><br /><br />
Catatan:
- Kamu bisa merubah kode yang berarna merah sesuai keinginan kalian.
Mudah kan?
Selamat mencoba.
Terimakasih telah membaca artikel Script Typewriter atau script mengetik sendiri dan terimakasih telah berkunjung.
Semoga bermanfaat.
No comments:
Post a Comment