Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

FormData.entries()

这篇翻译不完整。请帮忙从英语翻译这篇文章

The FormData.entries() 方法返回一个 iterator对象 ,此对象可以遍历访问FormData中的键值对。其中键值对的key是一个 USVString 对象;value是一个 USVString , 或者 Blob对象。

Note: 此方法在 Web Workers 可用.

语法

formData.entries();

返回值

返回 iterator

示例

// Create a test FormData object
var formData = new FormData();
formData.append('key1', 'value1');
formData.append('key2', 'value2');

// Display the key/value pairs
for(var pair of formData.entries()) {
   console.log(pair[0]+ ', '+ pair[1]); 
}

执行结果为:

key1, value1
key2, value2

规范

规范 状态 备注
XMLHttpRequest
entries() (as iterator<>)
Living Standard Initial definition

浏览器兼容

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 50.0 44 (44) ? ? ?
Available in web workers 50.0        
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support 未实现 50.0 44.0 (44) (Yes) ? ? ? 50.0
Available in web workers 未实现 50.0           50.0

 

相关链接

文档标签和贡献者

 此页面的贡献者: ianfung1998
 最后编辑者: ianfung1998,