<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < HTML xmlns= "http://www.w3.org/1999/xhtml" > <pead> <title>runcode</title> <meta http-equiv= " Content-type "content=" text/html; Charset=utf-8 "/> <meta name=" Author "content=" Sheneyan "/> <script type=" Text/javascript "> var mh = 30; Minimum height var step = 1;//per-change px var ms = 10;//Every how often cycle function Toggle (o) {if (!o.tid) O.tid = "_" + math.random () * 1 00; if (!window.toggler) Window.toggler = {}; if (!window.toggler[o.tid]) {window.toggler[o.tid]={obj:o, maxheight:o.offsetheight, MinHeight: MH, Timer:null, action:1}; } o.style.height = o.offsetheight + "px"; if (Window.toggler[o.tid].timer) cleartimeout (Window.toggler[o.tid].timer); Window.toggler[o.tid].action *=-1; Window.toggler[o.tid].timer = settimeout ("Anim ('" +o.tid+ ")", MS); function Anim (ID) {var t = Window.toggler[id]; var o = window.toggler[id].obj; if (T.action < 0) {if (o.offsetheight <= t.minheight) {cleartimeout (T.timer); Return } else{if (o.offsetheight >= t.maxheight) {cleartimeout (T.timer); Return } O.style.height = (parseint (o.style.height) + t.action * Step) + "px"; Window.toggler[id].timer = settimeout ("Anim ('" +id+ ")", MS); } </script> <style type= "Text/css" > Div.xx{border:solid 1px;overflow:hidden;} div.xx H5{border:solid 1px;border-width:0 0 1px;padding:0;margin:0;height:30px;line-height:30px;cursor:pointer;background: #eee;} </style> </pead> <body> <div class= "xx" ><p onclick= "Toggle (this.parentnode)" > Click I see Telescopic effect "</p> <p> cloud habitat </a></p> <br> <p> Love in the novel." </p><br> <p> Scripting Exchange Community </ p> <br> </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]