IE中的JavaScript字体系列问题

IE中的JavaScript字体系列问题,javascript,fonts,internet-explorer-8,Javascript,Fonts,Internet Explorer 8,有人能想出一个原因,这在任何版本的IE中都不起作用吗?我有一个下拉选择菜单,用于选择元素的字体系列,它调用javascript函数来更改字体系列。这是html <select id="selecth1FontFamily" name="selectFontFamily" onchange="updateh1family();"> <option> Serif </option>

有人能想出一个原因,这在任何版本的IE中都不起作用吗?我有一个下拉选择菜单,用于选择元素的字体系列,它调用javascript函数来更改字体系列。这是html

 <select id="selecth1FontFamily" name="selectFontFamily" onchange="updateh1family();">
                                  <option> Serif </option>
                                  <option> Arial </option>
                                  <option> Sans-Serif </option>                                  
                                  <option> Tahoma </option>
                                  <option> Verdana </option>
                                  <option> Lucida Sans Unicode </option>                               
                              </select>

这可以改变每个浏览器中元素的字体系列,不包括可怕的internet explorer。有什么想法吗?我的意思是,这是一个相当简单的函数,我试着想其他方法来实现它,但我几乎被卡住了。感谢所有读到这篇文章的人

如果调试代码,您会看到selector.value不返回任何内容

<!DOCTYPE html>
<html>
<head>
</head>
<body>
  <h1 id="liveh1">Some text</h1>
  <select id="selecth1FontFamily" name="selectFontFamily" onchange="updateh1family();">
    <option> Serif </option>
    <option> Arial </option>
    <option> Sans-Serif </option>                                  
    <option> Tahoma </option>
    <option> Verdana </option>
    <option> Lucida Sans Unicode </option>                               
  </select>
    <script>
      function updateh1family() {
        var selector = document.getElementById('selecth1FontFamily');
        var family = selector.options[selector.selectedIndex].value;
        var h1 = document.getElementById('liveh1')
        h1.style.fontFamily = family;        
      }

    </script>
</body>
</html>

我看不出有什么根本性的错误。你能把范围缩小到不起作用的地方吗?有错误吗?奇怪的是,没有抛出错误。我甚至挖掘了IE8开发工具进行调试,但什么也没有得到。字体家族没有改变。最奇怪的事……啊,非常感谢你。我想我需要了解调试代码的真正含义。我觉得自己像个傻瓜。再次感谢。
<!DOCTYPE html>
<html>
<head>
</head>
<body>
  <h1 id="liveh1">Some text</h1>
  <select id="selecth1FontFamily" name="selectFontFamily" onchange="updateh1family();">
    <option> Serif </option>
    <option> Arial </option>
    <option> Sans-Serif </option>                                  
    <option> Tahoma </option>
    <option> Verdana </option>
    <option> Lucida Sans Unicode </option>                               
  </select>
    <script>
      function updateh1family() {
        var selector = document.getElementById('selecth1FontFamily');
        var family = selector.options[selector.selectedIndex].value;
        var h1 = document.getElementById('liveh1')
        h1.style.fontFamily = family;        
      }

    </script>
</body>
</html>