<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="../resource/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../resource/js/jquery.tmpl.min.js"></script>
<script type="text/x-jquery-tmpl" id="template1" >
<div> ${'${'}username}: ${'${'}password}</div>
</script>
<script type="text/javascript" >
$(document).ready(function(){
var obj = {"username": "aaa", "password": "bbb"};
$("#a").html($("#template1").tmpl(obj));
});
</script>
</head>
<body>
<div id="a" ></div>
</body>
</html>
注意:引用js就行了
jquery.teml()小例子
最新推荐文章于 2022-03-29 22:14:10 发布