javascript在Chrome中工作,在IE中不工作
在Chrome浏览器中,当您单击此网页上的CloudCover时,将显示以下描述。在IE中,描述没有透露。有什么建议可以在IE中实现这一点吗javascript在Chrome中工作,在IE中不工作,javascript,internet-explorer,Javascript,Internet Explorer,在Chrome浏览器中,当您单击此网页上的CloudCover时,将显示以下描述。在IE中,描述没有透露。有什么建议可以在IE中实现这一点吗 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>min test</title>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>min test</title>
<script type='text/javascript'>
function showDescription (sel) {
var myVarDescip, myVarTEXT;
var myVar = (sel.value);
document.getElementById('putDescriptionHere').innerHTML = "";
myVarDescip = (myVar + "Descrip");
myVarTEXT = document.getElementById(myVarDescip).innerHTML;
document.getElementById('putDescriptionHere').innerHTML = myVarTEXT;
}
</script>
</head>
<body>
<select id="destSelect" size="3" multiple="multiple">
<option value="CloudCover" onclick="showDescription(this);">Cloud Cover</option>
</select>
<div id="CloudCoverDescrip" style="display: none">
<b>Cloud Cover:</b> The percentage of sky occluded by clouds.
</div>
<div id="putDescriptionHere"></div>
</body>
</html>
最小试验
功能说明(sel){
变量myVarDescip,myVarTEXT;
var myVar=(选择值);
document.getElementById('putDescriptionHere')。innerHTML=“”;
myVarDescip=(myVar+“Descrip”);
myVarTEXT=document.getElementById(myVarDescip).innerHTML;
document.getElementById('putDescriptionHere')。innerHTML=myVarTEXT;
}
云层
云量:天空被云层遮挡的百分比。
您不能将鼠标事件附加到IE中的选项上,因此单击永远不会触发
改用select上的onchange事件
<select id="destSelect" size="3" multiple="multiple" onchange="showDescription(this);">
您不能在IE中的选项上附加鼠标事件,因此单击永远不会触发 改用select上的onchange事件
<select id="destSelect" size="3" multiple="multiple" onchange="showDescription(this);">