这是我在 HTML 中的选择标记,我正在检索值,如下所示
谁能告诉我如何检索冒号 (:) 之前的值,例如如果它是 200:Java 编程语言我只需要 200 作为值
<select name = "book" id="selSeaShells">
<option></option>
<option value = "100:C programming language">C programming language</option>
<option value = "200:Java programming language">Java programming language</option>
</select>
function myFunction() {
var quantityvalue = document.getElementById("quan").value;
var selObj = document.getElementById('selSeaShells');
var optionselectedvalue;
var optionselectedtext;
for (i = 0; i < selObj.options.length; i++) {
if (selObj.options[i].selected) {
optionselectedvalue = selObj.options[i].value;
}
}
}