html - 此代码在 html 代码验证器中仍然有一个警告。我还需要插入什么?

标签 html

这是代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

看来我这里有问题:

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



<script type='text/javascript'>

function run(){
var div = document.createElement('div')
div.style.position = 'absolute'
div.style.left = '0px'
div.style.top = '0px'
div.onmouseover=function(){
    alert('mo')
    this.style.opacity = 0
}
div.style.width = '30px'
div.style.height = '30px';
div.style.backgroundColor = '#000'
document.body.appendChild(div)
}

onload = run
</script>
<title></title>

</head>

<body>

</body>

</html>

我还需要插入或编辑什么,以便我的代码在代码验证器中变得完全正常? 谢谢:)

最佳答案

使用直接输入将此代码转储到验证器时没有问题

http://validator.w3.org/#validate_by_input

你得到的一个警告是

Using Direct Input mode: UTF-8 character encoding assumed

您可以安全地忽略它。这只是意味着 UTF-8 被假定为直接输入。

关于html - 此代码在 html 代码验证器中仍然有一个警告。我还需要插入什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8391346/

相关文章:

php - 典型的 PHP 错误

html - 截断元素与非截断元素并排

html - Swift HTML 编码的 attributeText 被截断

javascript - 查找数组中最近的日期

html - 如何防止延迟样式在每次页面加载时加载,而不是仅在第一次加载时加载?

html - 创建一个带有微调器的提交按钮

javascript - JQuery-如何使用图像的 ALS 滚动脚本?

html - 在 div 上使用 `display:table-cell` 有缺点吗?

jquery - 无法使我的 lightbox2 在 IE 8 和 7 上工作

java - JSP java代码+html表格