<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<body>
一:
<textarea id=”showStr”></textarea>
<div style=”display:none” id=”string”>请在此输入您想咨询的问题
</div>
<script language=”javascript”>
var index=0;
var str=document.getElementById(“string”).innerHTML;
function type(){
if(index==str.length){index=0;}
document.getElementById(“showStr”).innerText = str.substring(0,index++);
}
setInterval(type, 500);
</script>
二:
<p id=”aa” class=”string”></p>
<p style=”display:none” id=”w”>请在此输入您想咨询的问题</p>
<script type=”text/javascript”>
window.onload = type;
var index = 0;
var word = $(“#w”).html();
function type(){
$(“#aa”).html(word.substring(0,index++));
if(index > word.length) {
return;
} else {
setTimeout(type,430);
};
}
</script>
</body>
</html>
原文链接:https://blog.csdn.net/liu__hua/article/details/38869615
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/17369.html