2016-02-26 78 views
0

你好我試圖呈現以下HTML無法使響應在Firefox

<html> 
 
<head> 
 
    <title></title> 
 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
 
</head> 
 
<body > 
 
    <select id="countrySelect" size="1"> 
 
     <option></option> 
 
     <option>USA</option> 
 
     <option>Singapore</option> 
 
    </select> 
 
    <button >show selected</button> 
 
</body> 
 
</html>

但是,得到下面的錯誤在瀏覽器控制檯: HTML文檔的字符編碼是未宣佈。如果文檔包含US-ASCII範圍之外的字符,則該文檔將在某些瀏覽器配置中呈現亂碼文本。頁面的字符編碼必須在文檔或傳輸協議中聲明。

+0

到底是什麼挑戰? –

+0

無論我放在服務器上,它的返回空白html頁面,以上錯誤都顯示在瀏覽器控制檯中。 – quorious

+0

它應該返回什麼? –

回答

1

請嘗試以下HTML代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
     <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <title>Untitled Document</title> 
     </head> 
     <body> 
     <select id="countrySelect" size="1"> 
      <option></option> 
      <option>USA</option> 
      <option>Singapore</option> 
     </select> 
     <button>show selected</button> 
     </body> 
</html> 
+0

同樣的結果,沒有成功。 – quorious

+0

請檢查我編輯的答案 –

+0

感謝它的工作。 – quorious