Home  >  Article  >  Web Front-end  >  json's foreground operation and background operation implementation code_json

json's foreground operation and background operation implementation code_json

WBOY
WBOYOriginal
2016-05-16 17:56:471212browse

The example is as follows:

Copy code The code is as follows:


< body>

Create object from JSON string



First Name: < ;br />
Last Name:






Then this time the application is to store data in json in the front page, Then send it to the background.
Attached is an application picture:
json's foreground operation and background operation implementation code_json
As can be seen from the picture, ModifyCellStyle is responsible for the style part of the font, but it cannot control alignment such as center, left, right, top, and center alignment. .ModifyString is to modify the content in the cell.
The format is as follows:
Copy the code The code is as follows:

var arrObj = []; //Action
Var act =
{"action":"ModifyCellStyle","bold":"true","italic":"false","cellIndex" :rowx ":" rowy};
arrObj.push(act); });
var sObj = JSON.stringify(arrObj);

Convert json into an array.
Take the ModifyCellStyle method as an example: the values ​​of bold, italic, and underline are Boolean values. That is, it can be true or false. The value of other sizeString, textColorString, cellColorString, etc. is string, and the value of cellIndex is "x, y", which are the abscissa and ordinate.
This API is mainly used in excel for cell operations. Record its historical operations. When you click save, the json-converted String is then sent to the background, where the data is received and excel is operated from the background.
Of course this requires loading the json2.js file. You can download it yourself
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn