`
wenxin2009
  • 浏览: 320572 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

新技术了解

 
阅读更多

1、json2html是基于javascript的html模板库,该库主要用于将json对象转换为html格式。

来源:http://www.iteye.com/news/27837

官网:http://json2html.com/

例子:

引入json2html.js文件

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<script type="text/javascript" src="js/jquery/json2html.js"></script>
<script type="text/javascript">
var movies = [
          	{ "Name": "The Red Violin", "ReleaseYear": "1998" },
      		{ "Name": "The blue Violin", "ReleaseYear": "1998" },
      		{ "Name": "The yellow Violin", "ReleaseYear": "1998" },
      		{ "Name": "The purple Violin", "ReleaseYear": "1998" },
      		{ "Name": "The orange Violin", "ReleaseYear": "1998" }
      	];

          var transform_shortHand = 
      			{"tag": "li", "children": [
      				{"tag":"b", "html":"${Name}"},
      				{"tag":"span", "html":"${ReleaseYear}"}			
      			]};

      	var transform_longHand = 
      			{"tag": "li", children: [
      				{"tag": "b", "html": function(){return(this.Name);}},
      				{"tag": "span", "html": function(){return(this.ReleaseYear);}}
      			]};
          var html1 = json2html.transform(movies,transform_shortHand);
          var html2 = json2html.transform(movies,transform_longHand);
      	document.write('<h1>Shorthand Test</h1>'+ html1 + '<br><br>' + html2);
</script>
</head>
<body>

</body>

 

2、iText JAR可生成PDF文件

相关网址:http://viralpatel.net/blogs/generate-pdf-file-in-java-using-itext-jar/

 

3、jQuery1.9.1与之前版本区别还是有些大的。

比如checkbox全选1.9.1用prop,之前版本用attr:

/* 全选\全不选 */
	$("#CheckAll").click(function(){
		var flag = $(this).prop("checked");
		$("input[name='subBox']").each(function(){
			$(this).prop("checked",flag);
		});
	});

 

<div>
        <input id="CheckAll" type="checkbox" />
        <input name="subBox" type="checkbox" />
        <input name="subBox" type="checkbox" />
        <input name="subBox" type="checkbox" />
        <input name="subBox" type="checkbox" />
    </div>

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics