-
Notifications
You must be signed in to change notification settings - Fork 0
/
templates1.html
36 lines (35 loc) · 1.26 KB
/
templates1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Intro</title>
</head>
<body>
<div id="pageContent">
<h1>ASP.NET Bookstore</h1>
<div id="bookContainer"></div>
</div>
<script type="text/javascript" src="jquery-1.4.4.js"></script>
<script type="text/javascript" src="jquery.tmpl.js"></script>
<script id="bookTemplate" type="text/x-jQuery-tmpl">
<div>
<img src="${picture}" width=50 height=50 alt="" />
<h2>${title}</h2>
price: ${price}
</div>
</script>
<script type="text/javascript">
// Create an array of books
var books = [
{ title: "ASP.NET 4 Unleashed", price: 37.79, picture: "1.jpg" },
{ title: "ASP.NET MVC Unleashed", price: 44.99, picture: "2.jpg" },
{ title: "ASP.NET Kick Start", price: 4.00, picture: "3.jpg" },
{ title: "ASP.NET MVC Unleashed iPhone", price: 44.99, picture: "4.jpg" },
];
// Render the books using the template
$("#bookTemplate").tmpl(books).appendTo("#bookContainer");
</script>
</body>
</html>