返回到:Prototype – 基本对象
此方法将对象转换为其 URL 编码的查询字符串表示形式。
这是一种序列化形式,主要用于为 Ajax 名称空间(例如 Ajax.Request)中的对象等内容提供复杂的参数集。
语法
Object.toQueryString(obj);
返回值
返回一个编码字符串。
例子
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
var o = { action: 'ship', order_id: 123,
fees: ['f1', 'f2'], 'label': 'a demo' };
alert("URI: " + Object.toQueryString(o) );
}
</script>
</head>
<body>
<p>Click the button to see the result.</p>
<br />
<br />
<input type = "button" value = "Result" onclick = "showResult();"/>
</body>
</html>返回到:Prototype – 基本对象
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/8655.html
支付宝
微信