2016-02-26 76 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