[HTML] 纯文本查看 复制代码 <select name="" id="select_id" onchange="getOption()">
<option value="">plz choose</option>
<option value="https://static.52pojie.cn/static/image/common/logo.png">option1</option>
<option value="https://www.52pojie.cn/logo.gif">option2</option>
</select>
<img id="imgurl" src="" />
<script>
var img_node = document.getElementById("imgurl");
console.log("imgurl : " + img_node.src);
var getOption = function () {
var objS = document.getElementById("select_id");
img_node.src = objS.options[objS.selectedIndex].value
console.log("imgurl : " + img_node.src);
}
</script> |