1

このように国の都市を動的に選択するためのコードを作成しました。コードはMozila、Chrome、Opera、Safari、Internet Explorer 9で正常に動作しますが、国の都市の動的選択はInternetExplorer8以前のバージョンでは機能しません。

<form method=post id="formname" name="formname" action=eaccountdb.php 
      enctype="multipart/form-data"  onsubmit="return Validate();">
  <table class="style2">
    <tr>
      <td>
        <table align="left" width="100%">
          <tr>
            <td align="left">
              <label for="country">Country*</label>
      <?php
      $country = $_GET['country'];
      if ($country == null)
      {
          $data = mysql_query("select * from country where countryname !='$country'");
          echo "
                <select name='country' style='width:150px' id='country' 
                        onchange='show_country(this.value);'>
                  <option>Select Country</option>";
          while ($info = mysql_fetch_array($data))
          {
              echo "<option>". $info['countryname']."</option>" ;
          }
          echo "</select>";
      }
      ...
4

1 に答える 1

1

value推測では、オプション要素の属性を指定していないためだと思います。W3C標準に準拠しているブラウザでは、value属性のないオプションの値はオプションのテキストです。残念ながら、IE8以下は標準のその特定の部分に準拠していませんでした。簡単な答えは、次のような値を各オプションに入れることです。

  echo "<option value=". $info['cityname'].">". $info['cityname']."</option>" ; 
于 2012-05-18T07:20:22.580 に答える