json(数据格式) 和xml相似,传输数据
JSON基于两种结构:
map:名称/值对的集合。在各种语言中,这被实现为对象,记录,结构,字典,散列表,键控列表或关联数组。
一般key:类型有字符串、数字
value:类型有字符串、数字、对象(map/list)
map:在json中的定义是:{},
map是一个键值对:{"key":"value"},
多个键值对:{"key":"value","key2":"value2"}
复杂类型:{"key":1,"key2":1.5,"key3":"value3","key4":{"key":"value","key2":"value2"},"key5":[]}
list:有序的值列表。在大多数语言中,这被实现为数组,向量,列表或序列。
list:类型有字符串、数字、对象(map/list)
list:在json中的定义是[],list是一个有序的列表:["1","2","3"]
复杂类型:["1",2,1.5,true,{"key":"value"},[]]
格式:
对象object/就是map
{"string":object,"str":1,"str1":1,"str2":1}
value:可以使用String、number、object、array、boolean、null
array
["sss",1,true,null,[],{}]
json转换java对象
json中的{}看作为java 对象中的对象 /map集合
json中的[]看作为java list集合对象
BOM
浏览器对象模型(BOM--Browser Object Model) 了解一下 就是操作浏览器的对象--也可以理解为浏览器本身
test.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<button type="button" onclick="dakaick()">打开新的窗口</button>
<button type="button" onclick="openWin()">打开窗口</button>
<button type="button" onclick="moveWin()">移动窗口</button>
<button type="button" onclick="close123()">关闭窗口</button>
<script type="text/javascript">
//BOM
window.document.write("BOM");
var ck;
function dakaick(){
ck = window.open();
}
var myWindow;
function openWin(){
myWindow = window.open('','','width=200,height=100');
myWindow.document.write("<p>这是我的窗口</p>");
}
function moveWin(){
console.log(window.screen);
myWindow.moveTo(1920/2,1080/2);
myWindow.focus();
}
function close123(){
alert(3);
window.close();
}
function qianjin(){
history.go(1);
}
function houtui(){
history.go(-1);
}
</script>
</body>
</html>