html5表单验证用placeholder显示错误提示:
1、html5包含校验的placeholder如下:
<form action="#" method="post">
<div>
<label for="name">Text Input:</label>
<input type="text" placeholder="Your name" name="name" id="name" value="" tabindex="1" />
</div>
<div>
<label for="name_2">Text Input 2:</label>
<input type="text" placeholder="Your name" name="name_2" id="name_2" value="" tabindex="1" />
</div>
<div>
<label for="textarea">Textarea:</label>
<textarea placeholder="Some text" cols="40" rows="8" name="textarea" id="textarea"></textarea>
</div>
<div>
<label for="textarea">Textarea 2:</label>
<textarea placeholder="Some text" cols="40" rows="8" name="textarea_2" id="textarea_2"></textarea>
</div>
<div>
<input type="submit" value="Submit" />
</div>
</form>
2、css样式:
::-webkit-input-placeholder {
color: #999
}
:-moz-placeholder {
color: #999
}
::-moz-placeholder {
color: #999
}
:-ms-input-placeholder {
color: #999
}
/* Different color for some fields */
#name_2::-webkit-input-placeholder,
#textarea_2::-webkit-input-placeholder
{
color: #FF0000
}
#name_2:-moz-placeholder,
#textarea_2:-moz-placeholder
{
color: #FF0000
}
#name_2::-moz-placeholder,
#textarea_2::-moz-placeholder
{
color: #FF0000
}
#name_2:-ms-input-placeholder,
#textarea_2:-ms-input-placeholder
{
color: #FF0000
}
3、运行效果:
提交出错就是红色的
楼主 你把js 里面的函数改一下 改成下面这样就可以了<script>
function check() {
var pass1=document.getElementById("pass1")
var pass2=document.getElementById("pass2")
var email=document.getElementById("email")
if(pass1.value!=pass2.value){
pass2.setCustomValidity("密码不一致。")
}
else if(pass1.value==pass2.value){
pass2.setCustomValidity("")
}
else if(!email.checkValidity()){
email.setCustomValidity("请输入正确的Email地址。")
}
else{
email.setCustomValidity("")
}
}
</script>
电脑看视频显示html5:Video file not found是设置错误造成的,解决方法为:
1、使用360安全浏览器打开视频网站之后,点击 工具,开发人员工具。
2、点击右下角的齿轮图标。
3、点击 Overrides,然后勾选 Enable,User Agent,然后点击下方的下拉列表。
4、任意选择一款手机或平板。
5、确认设置无误之后,点击刷新当前窗口的网页。
6、如下图所示,即已经可以观看视频,右上角提示自定义Agent,不影响使用。