1、在线检查:http://validator.w3.org/;
2、工具检查,例如:Html Validator。
Html Validator是Firefox的一个附加组件,以前看《精通CSS》提到的一些工具都因为不方便而没使用,每次都是在W3C在线验证查看代码是否规范。虽说过于追求标准有时没必要,但可能就因为有这种“标准癖”,没通过验证总觉得代码还是有问题。这个扩展真是解决了我不少问题。
Html Validator验证起来很方便。本地验证速度比W3C的在线网页要快很多,页面打开就能查看存在多少个问题,几处错误几处警告都一目了然。
它的验证方式有3种:HTML 、Tidy、SGML解析器和连续。前两种分别适合HTML和XHTML的验证,第三种为两种模式各验证一遍。
<!DOCTYPE html><html>
<head>
<meta charset="utf-8">
<title>Document</title>
<style>
body{
background: url(images/681662.jpg)
}
table{
width: 400px
height: 400px
margin: 0 auto
border: 1px solid #ccc
border-collapse: collapse
}
tr{
border: 1px solid #ccc
}
td{
/*width: 200px*/
height: 70px
text-align: center
/*border: 1px solid #ccc*/
}
div{
width: 100px
height: 70px
line-height: 70px
font-size: 12px
}
input{
opacity: .5
}
</style>
</head>
<body>
<table>
<tr>
<th colspan="3" style="font-size: 50px">注册</th>
</tr>
<tr>
<td>账号:</td>
<td>
<input type="text" style="width: 200pxheight: 30px" id="username" placeholder="请填写6~11字符">
</td>
<td>
<div id="username2"></div>
</td>
</tr>
<tr>
<td>密码:</td>
<td>
<input type="password" style="width: 200pxheight: 30px" id="password" placeholder="请填写6~11字符">
</td>
<td>
<div id="password2"></div>
</td>
</tr>
<tr>
<td>邮箱:</td>
<td>
<input type="text" style="width: 200pxheight: 30px" id="email" placeholder="请输入正确的邮箱">
</td>
<td>
<div id="email2"></div>
</td>
</tr>
<tr>
<td colspan="3">
<input type="submit" value="检测" onclick= "check()">
<input type="submit" value="注册" onclick= "register()">
</td>
</tr>
</table>
</body>
<script>
// 用于通过ID获取元素
function $(id)
{
return document.getElementById(id)
}
//定义id
var username = $('username')
var username2= $('username2')
var password = $('password')
var password2= $('password2')
var email = $('email')
var email2= $('email2')
//点击检测按钮
function check()
{
//判断账号的输入
var user = username.value
if(user.length != 0 ){
if(user.length >= 6 &&user.length <= 11){//判断输入的值个数为6~11个
if(user.charAt(0).search(/[a-zA-Z1-9]/g) != -1 ){//判断第一个值
var str = user.split("",11)//转化为数组
// console.log(str)
for(var i = 1i <= str.length-1i++){
if(str[i].search(/[a-zA-Z0-9]/g) != -1){
username2.innerHTML = "您输入的账号正确"
}else{
username2.innerHTML = "请输入正确的格式"
break
}
}
}else{
username2.innerHTML = "请输入正确的账号"
}
}else{
username2.innerHTML = "请输入正确的格式"
}
}else{
username2.innerHTML = "不能为空!"
}
//判断密码的输入
if(password.value.length != 0){
if(password.value.length >= 6 &&password.value.length <= 11){
password2.innerHTML = "您输入的密码正确"
}else{
password2.innerHTML = "请输入正确的格式"
}
}else{
password2.innerHTML = "不能为空!"
}
//判断邮箱
///\w + @[a-z0-9] + \.[a-z]{1,2}/g
var em = email.value
var str = em.split("")
// console.log(str)
var re = /^\w+@[a-z0-9]+\.[a-z]{2,3}$/
if(em.length != 0){
if(re.test(em)){
email2.innerHTML = "您输入的邮箱正确"
console.log(1)
}else{
email2.innerHTML = "请输入正确的格式"
console.log(2)
}
}else{
email2.innerHTML = "不能为空!"
}
}
function register(){
alert("你太丑了,本站不接受你的注册 0_0")
}
</script>
</html>
遨游用的是ie的内核,所以和效果和ie一样,你最好把代码贴上来看看,仅这样说谁知道具体是什么原因!你把代码贴上来看看啊!
首先你应该查查html的所有标签的所有对应结束符号是否完整。
第二、看看代码里没现实的文字部分的样式,是不是有做了隐藏设置(如果是你自己写的样式估计这个不应该有问题)!
第三、查查样式里有没有定义高,并且定义了超出部分隐藏了!
其他只能等见到代码才知道具体原因。 祝你早日解决问题。