Examples are as follows:
Copy Code code as follows:
<body>
<p>
Name: <span id= "fname" ></span><br/>
Last Name: <span id= "lname" ></span><br/>
</p>
<script type= "Text/javascript" >
var txt = ' {employees ': [' +
' {"FirstName": "Bill", "LastName": "Gates"}, ' +
' {"FirstName": "George", "LastName": "Bush"}, ' +
' {"FirstName": "Thomas", "LastName": "Carter"}]} ';
var obj = eval ("+ txt +"));
document.getElementById ("FName"). Innerhtml=obj.employees[1].firstname
document.getElementById ("LName"). Innerhtml=obj.employees[1].lastname
</script>
</body>
The app then stores the data into JSON in the foreground page and sends it back to the background.
Attached to the application of a picture:
The Modifycellstyle is responsible for the style part of the font, but it cannot control the right and top alignment of the center and the center alignment. Modifystring is to modify the contents of the cell.
Use the following format:
Copy Code code as follows:
var arrobj = []; Action
Var act =
{"Action": "Modifycellstyle", "bold": "True", "Italic": "false", "CellIndex": rowx+ ":" +rowy};
Arrobj.push (ACT); });
var sobj = json.stringify (arrobj);
Converts JSON to an array.
Take the Modifycellstyle method as an example: bold (Bold), Itelic (Italic), underline (underlined) value is a Boolean value. Take True or false. The values of other sizestring,textcolorstring,cellcolorstring such as String,cellindex are "x,y" i.e. horizontal and vertical coordinates.
This API is used primarily in Excel for the operation of cells. Record its history operation. When you click Save, the JSON-converted string is passed to the background, receiving the data backstage, and manipulating Excel from the background.
Of course this is to load the Json2.js file. You can download it yourself