奇怪的XHTML严格1.0下拉错误

时间:2015-09-02 16:56:27

标签: debugging drop-down-menu xhtml

几天前,我开始在XHTML Strict 1.0中编写转换器。虽然我正在制作下拉菜单,但我意识到选择之间存在随机空格。有什么方法可以解决它吗?这是我相当简单而又长的代码:(注意:它正在进行中,所以请忽略所有随机下拉选项:D。我也使用谷歌chorme。最后,如果你没关系只能用javascript修复它。)



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html lang="EN" dit="ltr" xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="Content-Type" content="text/xml; charset=utf-8" />
        <title>UKConverter</title>
        <script type = "text/javascript">
        </script>
      </head>
      
      <body>
        <h1>Converter!</h1>
        <form action = "">
          <p>
            <label>UK or US units?<label>
            <select id = "country">
              <option value = "UK">UK</option>
              <option value = "US">US</option>
            </select>  
          </p>
          
          <p>
            <label>Which type of category?</label>
            <select id = "catergory">
              <option value = "temperature">Temperature</option>
              <option value = "volume">Volume</option>
              <option value = "distance">Distance</option>
              <option value = "weight">Weight</option>
              <option value = "area">Area</option>
              <option value = "speed">Speed</option>
              <option value = "dataByte">Data byte</option>
              <option value = "time">Time</option>
            </select>
          </p>  
            
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "temperature">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "volumeUK">
              <option value = "cubicMeter">Cubic meter</option>	
              <option value = "cubicDecimeter">Cubic decimeter</option>
    	      <option value = "cubicCentimeter">Cubic centimeter</option>
    	      <option value = "liter">Liter</option>
    	      <option value = "deciliter">Deciliter</option>	 
    	      <option value = "centiliter">Centiliter<option>
    	      <option value = "milliliter">Milliliter</option>	
              <option value = "cubicInch">Cubic inch</option>
    	      <option value = "cubicFoot">Cubic foot</option>
    	      <option value = "cubicYard">Cubic yard</option>
    	      <option value = "gallon">Gallon</option>	 
    	      <option value = "oilBarrel">Oil barrel<option>
    	      <option value = "pint">Pint<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "volumeUS">
              <option value = "cubicMeter">Cubic meter</option>	
              <option value = "cubicDecimeter">Cubic decimeter</option>
    	      <option value = "cubicCentimeter">Cubic centimeter</option>
    	      <option value = "liter">Liter</option>
    	      <option value = "deciliter">Deciliter</option>	 
    	      <option value = "centiliter">Centiliter<option>
    	      <option value = "milliliter">Milliliter</option>	
              <option value = "cubicInch">Cubic inch</option>
    	      <option value = "cubicFoot">Cubic foot</option>
    	      <option value = "cubicYard">Cubic yard</option>
    	      <option value = "gallon">Gallon</option>	 
    	      <option value = "oilBarrel">Oil barrel<option>
    	      <option value = "fluidPint">Fluid pint<option>
    	      <option value = "dryPint">Dry pint<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "distance">
              <option value = "kilometer">Kilometer</option>	
              <option value = "meter">Meter</option>
    	      <option value = "decimeter">Decimeter</option>
    	      <option value = "centimeter">Centimeter</option>
    	      <option value = "millimeter">Millimeter</option>	 
    	      <option value = "mile">Mile<option>
    	      <option value = "inch">Inch</option>
    	      <option value = "foot">Foot</option>
    	      <option value = "yard">Yard</option>	 
    	      <option value = "nauticalMile">Nautical mile<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "weight">
              <option value = "tonne">Tonne</option>	
              <option value = "kilogram">Kilogram</option>
    	      <option value = "hectogram">Hectogram</option>
    	      <option value = "gram">Gram</option>
    	      <option value = "decigram">Decigram</option>	 
    	      <option value = "centigram">Centigram<option>
    	      <option value = "milligram">Milligram</option>	
              <option value = "microgram">Microgram</option>
    	      <option value = "carat">Carat</option>
    	      <option value = "grain">Grain</option>
    	      <option value = "ounce">Ounce</option>	 
    	      <option value = "pound">Pound<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert to?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert to?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert to?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert to?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert to?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert from?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
          
          <p> 
            <label>What type of unit would you like to convert to?<label>
            <select id = "typeOfUnit">
              <option value = "celsius">Celsius</option>	
              <option value = "fahrenheit">Fahrenheit</option>
    	      <option value = "kelvin">Kelvin</option>
    	      <option value = "reaumur">Reaumur</option>
    	      <option value = "newton">Newton</option>	 
    	      <option value = "rankine">Rankine<option>
            </select>  
          </p>
        </form>
      </body>
    </html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

您的HTML似乎格式不正确。块元素<option>缺少结束标记。

在大多数情况下,我看到下拉列表中的空白项目是因为开头</option>缺少结束<option>

有几种验证工具可以确定良好的形成。或者您可以使用具有语法突出显示功能的IDE。