如何将选择框中的选项值列表存储到以逗号分隔的变量中?
IE:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<select id="fruits">
<option value="orange">orange</option>
<option value="banana">banana</option>
<option value="kiwi">kiwi</option>
<option value="mango">mango</option>
<option value="pear">pear</option>
<option value="strawberry">strawberry</option>
</select>
</body>
</html>
var 如下:
var x = "orange,banana,kiwi,mango,pear,strawberry"