<! 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>guestbook demo</title> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/> <meta name=" Author "content=" Sheneyan "/> <script type=" Text/javascript "> var data = [{id:11, Name: ' Passerby ', Mail: ' somebodyA@foo.com ', title: ' Test this message board with no ', content: ' Test is testing, do not ask me why the test, also don't ask me for what test, anyway, I was to measure Try, what can you do to me? ', Time: ' 2007-03-21 12:33:43 '}, {id:12, name: ' Passerby B ', Mail: ' somebodyB@foo.com ', title: ' Hello, trouble you one thing ', content: ' Hello, can you tell Sue me for your QQ? I have trouble with you ', Time: ' 2007-03-22 22:33:43 '}, {id:13, name: ' Passerby C ', Mail: ' somebodyC@foo.com ', title: ' Ah Ah ', content: ' The world is so beautiful , I am so grumpy, so bad ~ ~ ', Time: ' 2007-03-23 12:03:41 '}, {id:14, Name: ' Passerby Ding ', Mail: ' somebodyD@foo.com ', title: ' ... ', con Tent: ' Actually ... I'm an actress ', Time: ' 2007-03-23 22:04:08 '}, {id:15, name: ' xxx ', Mail: ' Armya@fOo.com ', title: ' xxx ', content: ' Long night no new sleep, Yi, how sir you also did not sleep? ', Time: ' 2007-03-24 11:12:55 '}]; function Getmutlidata () {var x = p = document.getElementById (' post '); for (var i = 0; i < data.length i + +) {var o = P.clonenode (true); if (x.nextsibling) X.parentnode.insertbefore (o,x.nextsibling); else X.parentnode.appendchild (o); var t = o.innerhtml; t = t.replace (/<!--{(. *?)} -->/g,function (a,b) {var v = ""; try{v = eval ("data[" +i+ "]." +B); catch (e) {} return v; }); o.innerhtml = t; x = o; } p.style.display= ' None '; } </script> </pead> <body> <div id= "POST" > <fieldset> <legend id= "Post_header" > ( <!--{id}-->) ' ><!--{name}--> in <!--{time}--> published:</legend> <p id= ' Post_title ' ><! --{title}--></p> <p id= "post_content" ><!--{content}--></p> </fieldset> </div > <button onclick= "getmutlidata ()" > Get multiple data (simulate AJAX fetch data) </button> </body> </pTml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]