Este artículo describe el efecto de la máquina de escribir implementado por JS. Compártelo para su referencia, como sigue:
<! DocType html> <html lang = "en"> <head> <meta charset = "utf-8"> <!-siempre forzar el último motor de representación de IE (incluso en intranet) y el marco de Chrome elimina esto si usa el contenido .htaccess-> <meta http-equiviv = "x-ua compatible" centent = "ie = board, crome, crome> 1, JS> 1", JS> 1 ", Js> 1" Título> <boate>. efecto tytewriter </title> <meta name = "descripción" content = ""> <meta name = "autor" content = "administrador"> <meta name = "viewport" content = "width = dispositivo-width; inicial-escala = 1.0"> <!-reemplazar favicon.ico & apple-touch-iCon.png en la raíz de su dominio y deglete estas referencias-> <estilo de estilo = "text/cs" {ancho: 80%; Altura: 750px; margen: auto; relleno: 10px; Antecedentes: #CFE1CA; borde: salida de 10px #F9C6AA; Línea de altura: 30px; Color: #9f3c61; tamaño de fuente: 18px; } p {text-indent: 30px; } </style> <script type = "text/javaScript"> var tytewriter = {msg: function (msg) {return msg; }, len: function () {return this.msg.length; }, seq: 0, velocidad: 150, // tipeo de tiempo (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 ("Bienvenido a //www.vevb.com") var msg = "JS Efecto de máquina de escribir, el principio es muy simple: obtener un valor adicional de la cadena a escrito en un momento, salida y sobrescribir el contenido de salida original"; función getMsg () {return msg; } tytewriter.msg = getMsg (msg); máquina de escribir.type (); } </script> </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 y técnicas de recorrido ", y" Resumen del uso de operaciones matemáticas de JavaScript "
Espero que este artículo sea útil para la programación de JavaScript de todos.