1

我希望仅在下拉菜单不等于排名或选择位置时才使用 CSS 覆盖值 #bigbox 和 #bigbox-window ...

这是我的第一篇文章,请原谅任何格式错误!谢谢!

<html>
  <style>
    #bigbox { height:680px; }
    #bigbox-window { height:680px; }
  </style>      
  <script language="javascript" type="text/javascript">

    function setIframeSource() { 
      var theSelect = document.getElementById('location');
      var theIframe = document.getElementById('myIframe');
      var theUrl;

      theUrl = theSelect.options[theSelect.selectedIndex].value;
      theIframe.src = theUrl;
    }

  </script>
  <body>
    <div class="page page-pick_em">
      <h1>College Hockey Pick 'Em League</h1>
      <form id="form1" method="post">
        <label>
          <select id="location" onchange="setIframeSource()"> 
            <option value="">Select a location ...</option> 
            <option value="page/pick_em/standings.html">Standings</option> 
            <option value="page/pick_em/week01.html">Week 01</option> 
            <option value="page/pick_em/week02.html">Week 02</option> 
          </select>
        </label>
      </form>
      <iframe SRC="page/pick_em/standings.html" width="100%" height="80%" id="myIframe" marginheight="0" frameborder="0" onLoad="autoResize('myIframe');"></iframe>
    </div>
  </body>
<html>
4

1 回答 1

0

好吧,当下拉列表不是您在问题中指定的选项时,这会更改 CSS。

由于我不知道您在哪里使用bigboxand bigbox-window,以及您想在这些样式中更改什么,请按照我的示例进行调整以适应您的需求。

看到这个小提琴

theOptText = theSelect.options[theSelect.selectedIndex].text;
if ((theOptText != "Select a location ...") && (theOptText != "Standings"))
{
    document.getElementById("bigbox").style.borderColor = "#f00";
}
于 2012-12-15T00:58:25.330 回答