json

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
var person={"name":"denny","age":43};

function showperson()
{
person.name="rose";
alert(person.name);
alert(person.age);
}
var persons =["rose","denny","jac\"k"];
function showpersons()
{
alert(persons[2]);

}
var person2 =
{
"emp":[
{
"name":"denny",
"age":12,
"addr":["sh","bj"]
}
  ]
}
function showperson2()
{
//alert(person2.emp);
//alert(person2.emp[0].name);
alert(person2.emp[0].addr[1]);

}

var brand =[{"name":"ibm","country":"usa"},{"name":"sony","country":"jp"}];
var brand1 ={"brands":[{"name":"ibm","country":"usa"},{"name":"sony","country":"jp"}]};
function showbrand()
{

alert(brand[1].name);
alert(brand[1].country);

}
function showbrand1()
{

alert(brand1.brands[1].name);
alert(brand1.brands[1].country);

}

//var mya=["a","b","c"];
var myo={"name":"denny","age":43};

function showArray(){
for ( k in myo){
alert(k);
alert(myo[k]);
}
}

var myarr = new Array();

myarr["a"]="a";

alert(myarr["a"]);

</script>
  </head>
 
  <body>
    <a href="#" onclick="showArray();">showArray</a>
  </body>
</html>

你可能感兴趣的:(html,c,json,jsp,IBM)