为什么';这个javascript代码在InternetExplorer中不起作用吗?

为什么';这个javascript代码在InternetExplorer中不起作用吗?,javascript,internet-explorer,cross-browser,internet-explorer-9,Javascript,Internet Explorer,Cross Browser,Internet Explorer 9,有人能检查一下为什么我的javascript代码在InternetExplorer9中不工作,但在Firefox中正常工作吗???此外,该代码在Google Chrome中不起作用 <html> <head> <title>test</title> <script type="text/javascript"> function showF4(){ document.getElementById('s

有人能检查一下为什么我的javascript代码在InternetExplorer9中不工作,但在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>

测试
函数showF4(){
document.getElementById('showF4').style.display=“block”;
}

F4文件清单

*特色:

F4文件列表
选项
s没有像
onClick
这样的事件,而是选择框。将那些从
选项
移到
选择
,并更改为适当的方法,如
onChange
等。

F4文档列表

选项
s没有像
onClick
这样的事件,而是选择框。将那些从
选项中移出
选择
,并更改为适当的方法,如
onChange
等。

因此我发现了以下内容:

其中一个人给出了这个答案

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. 

看一看,它可能会解决您的问题,因此我发现以下几点:

其中一个人给出了这个答案

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. 

看看,它可能会解决您的问题

js函数showForm7()和hideForm7()在哪里这些事件不是为
元素目标showForm7()和hideForm7()定义的,没有什么重要的,只要看看showF4(),我想显示block show f4,当我单击下拉菜单时js函数showForm7()和hideForm7()在哪里这些事件不是为
元素target showForm7()和hideForm7()定义的,没有什么重要的,只要看看showF4(),我想显示block show f4,当我单击下拉菜单时,请选择f4文档列表和结果,它在IE中工作,但这会给我带来麻烦,因为,我将需要完全更改javascript代码,我这里有任何其他解决方案,每次调用不同的javascript函数,当我点击你必须做你必须做的事情时。你当然可以在网上找到一些黑客行为,但是option标签默认没有这些事件。此外,你有很多方法可以使用
select
元素简化它。你可以使用更多的事件,比如onMouseOver、onChange、onClick等,请选择F4文档列表,结果是什么,它在IE中工作,但这会给我带来麻烦,因为我需要完全更改javascript代码,这里有其他解决方案,每次调用不同的javascript函数,当我点击时,你必须做你必须做的事情。你当然可以在网上找到一些黑客行为,但是option标签默认没有这些事件。此外,你有很多方法可以使用
select
元素简化它。您可以使用更多的事件,如onMouseOver、onChange、onClick等