<!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" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="application/javascript" src="/js/libs/
jquery.js"></script>
<title>javascript打印输出json的例子 - www.jb200.com</title>
</head>
<body>
<p>Click me!</p>
</body>
</html>
<script language="javascript">
/**
* 打印输出json
* edit: www.jb200.com
*/
function handler(event) {
var s="";
s=s+"{";
for(var i in event.data){
s = s + i + ":" + event.data[i] + ",";
}
s = s.substring(0,s.length-1);
s = s+"}";
alert(s);
}
$("p").bind("click", {foo: "bar",f:"two"}, handler)
</script>