Este artigo descreve o efeito da máquina de escrever implementado pelo JS. Compartilhe -o para sua referência, como segue:
<! Doctype html> <html lang = "pt"> <head> <meta charset = "utf-8"> <!-sempre forçar o mecanismo de renderização mais recente do IE (mesmo em Intranet) e Chrome Frame Remover isso se você usa o .htaccess-> <meta http-equiv = "x-ua-comppatible" Efeito da máquina de escrever </title> <meta name = "description" content = ""> <meta name = "author" content = "administrador"> <meta name = "viewport" content = "width = dispositivo-width; scale inicial = 1.0"> <!-Substitua Favicon.ICO e maçã-icon.png na raiz do seu raiz "e refere-se) e refere-se) e refere-se) e refere-se). {largura: 80%; Altura: 750px; margem: automático; preenchimento: 10px; Antecedentes: #cfe1ca; fronteira: 10px início #f9c6aa; altura de linha: 30px; Cor: #9F3C61; Size da fonte: 18px; } p {text-indent: 30px; } </style> <script type = "text/javascript"> var typewriter = {msg: function (msg) {return msg; }, len: function () {return this.msg.length; }, seq: 0, velocidade: 150, // tempo de digitação (ms) tipo: function () {var _This = this; document.getElementById ("main"). innerhtml = _this.msg.substring (0, _this.seq); if (_this.seq == _this.len ()) {_this.seq = 0; ClearTimeout (t); } else {_this.seq ++; var t = setTimeout (function () {_ this.type ()}, this.speed); }}} window.onload = function () {alert ("Bem -vindo para //www.vevb.com") var msg = "JS Efeito da máquina de escrever, o princípio é muito simples: obtenha um valor adicional da string a ser digitado por vez, saída e sobrescrever o conteúdo original de saída"; function getmsg () {return msg; } typewriter.msg = getMSG (msg); typwriter.type (); } </script> </ad Head> <body> <div id = "main"> </div> </body> </html>For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of Javascript Algoritmos e Técnicas de Traversal "e" Resumo do Uso do Javascript Mathematic Operations "
Espero que este artigo seja útil para a programação JavaScript de todos.