To do a project today, the requirement is that the div inside is empty all the code is written in <script> inside the,<script> inside the text with JSON transmission. This to me a just out of school, with Div wrote three years of the page is really very difficult, not to mention I did not know what JSON before I entered the company, I am very fortunate that I have colleagues in this company bring Me, teach me, there will not be able to ask them. Really feel that these three years have been white learning, learning knowledge can not be integrated with the community ...
Fortunately, finally in the tutorial and the help of colleagues to write out, the following paste the source code.
<! DOCTYPE html>
<meta charset= "Utf-8"/>
<title> Testing Projects </title>
<script src= "Js\newdot.js" ></script>
The key points here refer to the Dot.js library. This library needs to be downloaded by itself
<style>
#center {text-align:center;}
#test {text-align:left;}
</style>
<body>
<div class= "mytest" id= "MyTest" >
</div>
<script type= "Text/javascript" >
Window.onload = function () {
var temp = dot.template ($ ("#mytemp"). html ());
Define a temp to enable the label with ID mytemp to read dot. JS inside the content
var mes = dot.template ($ ("#mydot"). html ());
Define an MES so that a label with ID Mydot can read dot. JS inside the content
$ ("#mytest"). Append (MES);
Append the obtained value to the mytest Div.
$ ("#mytest"). Append (temp);
Append the obtained value to the mytest Div.
{
<!--define a json-->
var json = {
"Test": "Mail genuine MA Jill compression mask non-woven paper film 100-Pack bottle Mask Brush Spray Bottle new",<!--find a label with ID test to make the document content =test-->
"Test1": "Parcel mail or courier fee or happy holiday; Love Frankfurt pride Kraft kara L"
};
var obj = eval (JSON); <!--use function eval to convert a defined JSON to a JS object--
document.getElementById ("Test"). InnerHTML = json.test;<!--Output value--
document.getElementById ("Test1"). Innerhtml=json.test1;
}
};</script>
<script id= "Mydot" type= "Text/template" >
<table class= "Sui-table table-bordered" >
<thead>
<tr>
<th id= "center" > </th>
<th id= "center" > New Customer uv</th>
<th id= "center" > New customer Conversion rate (%) </th>
<th id= "center" > Old customer uv</th>
<th id= "center" > Old customer conversion rate (%) </th>
</tr>
</thead>
<tbody>
<tr>
<TD id= "center" > Yesterday </td>
<TD id= "center" >1.0</td>
<TD id= "center" >15</td>
<TD id= "center" >11</td>
<TD id= "center" >1.3</td>
</tr>
<tr>
<TD id= "center" > Prev </td>
<TD id= "center" >1.1</td>
<TD id= "center" >32</td>
<TD id= "center" >32</td>
<TD id= "center" >24</td>
</tr>
<tr>
<TD id= "center" > Two days ago </td>
<TD id= "center" >2.0</td>
<TD id= "center" >24</td>
<TD id= "center" >12.00</td>
<TD id= "center" >1.25</td>
</tr>
<tr>
<TD id= "center" > Industry average </td>
<TD id= "center" >1.30</td>
<TD id= "center" >21</td>
<TD id= "center" >1.07</td>
<TD id= "center" >1.40</td>
</tr>
<tr>
<TD id= "center" > Current status </td>
<TD id= "center" ><span class= "Sui-label label-warning" > Below average </span</td>
<TD id= "center" ><span class= "Sui-label label-info" > Above average </span></td>
<TD id= "center" ><span class= "Sui-label label-success" > Flat </span></td>
<TD id= "center" ><span class= "Sui-label label-warning" > Below average </span></td>
</tr>
</tbody>
</table>
</script>
<script id= "mytemp" type= "Text/template" >
<table class= "Sui-table table-bordered" >
<thead>
<tr>
<th colspan= "5" >
<label class= "checkbox Pull-left" >
<input type= "checkbox" > Order Code: 7867473872181848
</label><span class= "Pull-right" > Deal time: 2014-01-11 11:59</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<TD width= "50%" >
<div class= "Typographic" >
<a href= "#" class= "Block-text" ><span id= "test" ><span></a>
<span>1</span>
<ul class= "unstyled" >
<li> after-sales </li>
<li> Complaint Sellers </li>
</ul>
</div>
</td>
<TD rowspan= "2" width= "11%" class= "center" >56.50</td>
<TD rowspan= "2" width= "13%" class= "Center" >
<ul class= "unstyled" >
<li> Trading Success </li>
<li><a href= "#" > Order Details </a></li>
<li><a href= "#" > Comments </a></li>
</ul>
</td>
<TD rowspan= "2" width= "13%" class= "center" ><a href= "#" class= "BTN" > Reviews </a></td>
<TD rowspan= "2" width= "13%" class= "Center" >
<ul class= "unstyled" >
<li><a href= "#" > Delete </a></li>
<li><a href= "#" > tags </a></li>
<li><a href= "#" > Share </a></li>
</ul>
</td>
</tr>
<tr>
<TD width= "50%" >
<div class= "Typographic" >
<a id= "Test1" href= "#" class= "Block-text" ></a>
<span>1</span>
<ul class= "unstyled" >
<li> after-sales </li>
<li> Complaint Sellers </li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</script>
</body>
Use JS for content display, and use JSON to transfer data