<! DOCTYPE html>
<script type= "text/javascript" >window.onload = function () {var ainput = document.getelementsbytagname ("input"); var odiv = document.getElementById ("Div1"); var str = ' Once a working girl, she is now the CEO of a listed company; she has been forced into marriage and is now transformed into the network's first matchmaker, and she has made her own career while fulfilling more people's happiness. She is the "Little Dragon Girl", the century Jiayuan CEO Shanhaiyan '; var timer = Null;var Inow = 0;ainput[0].onclick = function () {clearinterval (timer); timer = SetInterval (function () {var val = str.substring (0,++inow); odiv.innerhtml = Val;if (val = = str) {clearinterval (timer);}}, 50);} Ainput[1].onclick = function () {clearinterval (timer); timer = setinterval (function () {var val = str.substring (0, inow--) o div.innerhtml = val;if (val = = "") {clearinterval (timer);}},50)}}</script>
JS Expand & Shrink Two kinds