HTML显示乱码问题

 

在head添加:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

如果还不行,将utf-8改为gb2312

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Document</title>
</head>
<script>
var name=prompt("请在键盘输入名字:");
console.log(name);
alert(name);
</script>
<body>
<h1>标题</h1>
<p>这是一段测试文本!</p>
</body>
</html>

 

posted @ 2020-12-29 11:54  ITWebGirl  阅读(78)  评论(0)    收藏  举报