判断交付为空
判断提交为空
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>练习JQUERY</title>
<style>
*{ margin:0px;padding:0px;}
h2{ width:100%;text-align:center;line-height:36px;}
#Content{ margin:30px auto 0px auto;width:500px;height:100px;border:1px solid #ccc;}
#show{ width:300px;margin-left:180px;line-height:36px;}
</style>
<script src="jquery-1.8.3.js" type="text/javascript"></script>
</script>
<script>
$(function(){
$(".wrongLabel").hide();
valNew=$(".textNew").val();
$(".textNew").keyup(function(){
var len=$(".textNew").val().length;
$("font").remove();
$("color").remove();
if(len>12||len<6)
{
$(".wrongLabel").show();
$(".textNew").attr({maxlength:"12"});
$(".wrongLabel").css("color","orange");
}
else
{
$(".wrongLabel").css("color","");
$(".wrongLabel").hide();
}
$("#show").html("<label id='show'>"+len+"</label>");
});
$("form").submit(function(){
if (valNew==""||valNew<6){
$(".wrongLabel").show();
$(".wrongLabel").css("color","orange");
$(".textNew").focus();
return false;
}
});
$(".consoleOk").click(function(){
$(".wrongLabel").hide();
});
});
</script>
</head>
<body>
<form>
<div id="Content">
<p style=" margin-top:8px;">
输入的字符:<input type="text" name="char" class="textNew" /><label class="wrongLabel">不能超过这个范围</label><label id="show">0</label>/12
</p>
<input type="submit" class="consoleOk" value="提交"/>
</form>
</div>
</body>
</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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>练习JQUERY</title>
<style>
*{ margin:0px;padding:0px;}
h2{ width:100%;text-align:center;line-height:36px;}
#Content{ margin:30px auto 0px auto;width:500px;height:100px;border:1px solid #ccc;}
#show{ width:300px;margin-left:180px;line-height:36px;}
</style>
<script src="jquery-1.8.3.js" type="text/javascript"></script>
</script>
<script>
$(function(){
$(".wrongLabel").hide();
valNew=$(".textNew").val();
$(".textNew").keyup(function(){
var len=$(".textNew").val().length;
$("font").remove();
$("color").remove();
if(len>12||len<6)
{
$(".wrongLabel").show();
$(".textNew").attr({maxlength:"12"});
$(".wrongLabel").css("color","orange");
}
else
{
$(".wrongLabel").css("color","");
$(".wrongLabel").hide();
}
$("#show").html("<label id='show'>"+len+"</label>");
});
$("form").submit(function(){
if (valNew==""||valNew<6){
$(".wrongLabel").show();
$(".wrongLabel").css("color","orange");
$(".textNew").focus();
return false;
}
});
$(".consoleOk").click(function(){
$(".wrongLabel").hide();
});
});
</script>
</head>
<body>
<form>
<div id="Content">
<p style=" margin-top:8px;">
输入的字符:<input type="text" name="char" class="textNew" /><label class="wrongLabel">不能超过这个范围</label><label id="show">0</label>/12
</p>
<input type="submit" class="consoleOk" value="提交"/>
</form>
</div>
</body>
</html>
1 楼
dengbenlong
15 小时前
<!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>Jquery.color.js</title>
<style>
h1{text-align:center;}
.demo{width:960px; margin:0 auto; font-size:84%;}
.demo p a{color:#ff3300; text-decoration:none;}
a:hover{text-decoration:underline;}
</style>
<script src="jquery-1.8.3.js" type="text/javascript"></script>
</head>
<body>
<script>
//插件编写
;(function($){
$.fn.extend({
"color":function(value){
if (value ==undefined){
return this.css("color");
} else {
return this.css("color",value);
}
}
});
})(jQuery);
//插件应用
$(function(){
//查看第一个div的color样式值
alert($('div').color());
//把所有的div的字体颜色设置成蓝色
$('div').color('blue');
})
</script>
<div style="color:red">Red</div>
<div style="color:blue">Blue</div>
<div style="color:green">green</div>
<div style="color:yellow">yellow</div>
想看代码就直接点击鼠标右键==》查看源代码<br>
DEMO比较简陋。。
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jquery.color.js</title>
<style>
h1{text-align:center;}
.demo{width:960px; margin:0 auto; font-size:84%;}
.demo p a{color:#ff3300; text-decoration:none;}
a:hover{text-decoration:underline;}
</style>
<script src="jquery-1.8.3.js" type="text/javascript"></script>
</head>
<body>
<script>
//插件编写
;(function($){
$.fn.extend({
"color":function(value){
if (value ==undefined){
return this.css("color");
} else {
return this.css("color",value);
}
}
});
})(jQuery);
//插件应用
$(function(){
//查看第一个div的color样式值
alert($('div').color());
//把所有的div的字体颜色设置成蓝色
$('div').color('blue');
})
</script>
<div style="color:red">Red</div>
<div style="color:blue">Blue</div>
<div style="color:green">green</div>
<div style="color:yellow">yellow</div>
想看代码就直接点击鼠标右键==》查看源代码<br>
DEMO比较简陋。。
</body>
</html>