此方法返回一个 JSON 字符串。
语法
number.toJSON();
返回值
JSON 字符串。
例子
HTML
x
19
19
1
<html>
2
<head>
3
<title>Prototype examples</title>
4
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
5
6
<script>
7
function showResult() {
8
alert("(45).toJSON() : " + (45).toJSON() );
9
}
10
</script>
11
</head>
12
13
<body>
14
<p>Click the button to see the result.</p>
15
<br />
16
<br />
17
<input type = "button" value = "Result" onclick = "showResult();"/>
18
</body>
19
</html>
阅读剩余 72%
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/8915.html