首页 > 代码库 > JsRender系列demo(1)-insert-data

JsRender系列demo(1)-insert-data

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <script type="text/javascript" src="http://www.mamicode.com/scripts/jquery.js"></script>    <script type="text/javascript" src="http://www.mamicode.com/scripts/jquery-ui.js"></script>    <script type="text/javascript" src="http://www.mamicode.com/scripts/jsrender.js"></script>    <link href="http://www.mamicode.com/scripts/demos.css" rel="stylesheet" />   </head><body>     <script type="text/x-jsrender" id="movieTemplate">         <div>{{:#index+1}}:<b>{{>name}}</b>出版日期:{{>releaseYear}}</div>    </script>    <div id="movieList"></div>    <script type="text/javascript">        var movies = [            { name: "Cupid", releaseYear: "1998" },            { name: "陌上花开", releaseYear: "1999" },            { name: "Tina", releaseYear: "1976" }        ];        // Render the template with the movies data and insert        // the rendered HTML under the "movieList" element        //$("#movieList").html(        //    $("#movieTemplate").render(movies)        //);        $("#movieList").html($("#movieTemplate").render(movies));</script></body></html>  

  

JsRender系列demo(1)-insert-data