[英]Why doesn't this Dojo 1.9/JS code work in Internet Explorer 7?
[英]Why doesn't this javascript code work in Internet Explorer?
有人可以檢查為什么我的JavaScript代碼在Internet Explorer 9中不能正常運行,但是在Firefox中可以正常運行嗎? 另外,代碼在Google Chrome中不起作用。
<html>
<head>
<title>test</title>
<script type="text/javascript">
function showF4(){
document.getElementById('showF4').style.display = "block";
}
</script>
</head>
<body>
<form method="post" action="" enctype="multipart/form-data" method="post">
<p><select class="selField" id="list_sel" name="list_type" >
<option id="F4DOL" onmouseover="showForm7()" onmouseout="hideForm7()" onclick="showF4()" value="F4 Document List"> F4 Document List </option>
</select></p>
</form>
<div id="showF4" style="display: none">
<p><font color="red">*</font>Feature:
<input id="f4_input" name="f4_input" type="text" value="" /> </p>
</div>
</body>
</html>
<option id="F4DOL" onmouseover="showForm7()" onmouseout="hideForm7()" onclick="showF4()" value="F4 Document List"> F4 Document List </option>
option
沒有像onClick
這樣的事件,它的選擇框沒有。 將其移出option
以select
並更改為適當的方法,例如onChange
等。
所以我發現以下內容:
http://www.webmasterworld.com/forum91/4959.htm
有人給了這個答案
hi,
your method of setting the style of elements:
element.style.property="something";
will not work in ie. How to set styles with javascript depends not only on the browser, but in some cases also on other conditions, as if the style is inline or comes from css and on other things (for this see eg. quirksmode.org).
Therefore you might prefer to add styles for a specific class in your stylesheet, let's say
.noshow {visibility: hidden;}
and then use js to switch between visible and not by saying
element.className="noshow";
and
element.className="";
Hope this helps.
看看,它可能會解決您的問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.