资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

jquery在线编程,jquery操作html代码

使用jQuery编程实现:编写一个用户注册页面,需要输入用户名和输入2次密码,在点击“注册”按钮时

script type="text/javascript"

创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站建设、做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的克什克腾网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

//循环获取所有的input框

//定义全局变量

var NI=false;

var US=false;

var PS=false;

var RPS=false;

var EM=false;

var PH=false;

//给每个input绑定获取焦点事件

//昵称

$('input[name="nickname"]').focus(function(){

$(this).next().css({color:'#979898',display:'block'});

$(this).next().html('请输入常用昵称');

});

//账户

$('input[name="username"]').focus(function(){

$(this).next().css({color:'#979898',display:'block'});

$(this).next().html('请输入6-16个字符,首字符不能为数字');

});

//密码

$('input[name="password"]').focus(function(){

$(this).next().css({color:'#979898',display:'block'});

$(this).next().html('请输入6-16个字符,首字符不能为数字');

});

//重复密码

$('input[name="repassword"]').focus(function(){

$(this).next().css({color:'#979898',display:'block'});

$(this).next().html('请再次输入密码');

});

//邮箱

$('input[name="email"]').focus(function(){

$(this).next().css({color:'#979898',display:'block'});

$(this).next().html('请输入常用昵称');

});

//电话

$('input[name="phone"]').focus(function(){

$(this).next().css({color:'#979898',display:'block'});

$(this).next().html('请输入常用手机号码');

});

//给每个input绑定丧失焦点事件

//昵称

$('input[name="nickname"]').blur(function(){

var v=$(this).val();

var reg=/^.{1,16}$/;

if(!reg.test(v)){

$(this).next().html('✘输入有误,请重新输入');

$(this).next().css('color','red');

}else{

$(this).next().html('✔');

$(this).next().css('color','green');

NI=true;

}

});

//账户

$('input[name="username"]').blur(function(){

var v=$(this).val();

var input=$(this);

var reg=/^\w{6,16}$/;

if(!reg.test(v)){

input.next().html('✘输入有误,请重新输入');

input.next().css('color','red');

}else{

//发送ajax判断账户是否可用

$.post('{:U("Admin/Admin/select")}',{username:v},function(data){

if(data==0){

input.next().html('✘用户名已存在');

input.next().css('color','red');

}else{

input.next().html('✔');

input.next().css('color','green');

US=true;

}

});

}

});

//密码

$('input[name="password"]').blur(function(){

var v=$(this).val();

var reg=/^[a-zA-Z]{1}\w{5,15}$/;

if(!reg.test(v)){

$(this).next().html('✘输入有误,请重新输入');

$(this).next().css('color','red');

}else{

$(this).next().html('✔');

$(this).next().css('color','green');

PS=true;

}

});

//重复密码

$('input[name="repassword"]').blur(function(){

var rv=$(this).val();

var v=$('input[name=password]').val();

if(rv !== v){

$(this).next().html('✘重复密码输入有误');

$(this).next().css('color','red');

}else{

$(this).next().html('✔');

$(this).next().css('color','green');

RPS=true;

}

});

//邮箱

$('input[name=email]').blur(function(){

var v=$(this).val();

var reg = /^\w+@\w+\.(com|cn|com\.cn|org|hk|edu|net)$/;

if(!reg.test(v)){

$(this).next().html('✘输入有误,请重新输入');

$(this).next().css('color','red');

}else{

$(this).next().html('✔');

$(this).next().css('color','green');

EM=true;

}

});

//电话

$('input[name=phone]').blur(function(){

var v=$(this).val();

var reg=/^1\d{10}$/;

if(!reg.test(v)){

$(this).next().html('✘输入有误,请重新输入');

$(this).next().css('color','red');

}else{

$(this).next().html('✔');

$(this).next().css('color','green');

PH=true;

}

});

//绑定表单提交事件

$('button[name=Submit]').click(function(){

//alert('dasd');

$("input").each(function(){

$(this).next().css('display','block'); //循环让每个input框后面的span显示出来

});

//触发丧失焦点事件

$('input[name=nickname]').trigger('blur');

$('input[name=username]').trigger('blur');

$('input[name=password]').trigger('blur');

$('input[name=repassword]').trigger('blur');

$('input[name=email]').trigger('blur');

$('input[name=phone]').trigger('blur');

if(NI US PS RPS EM PH){

return true;

}

return false;

});

/script

jquery主要是做什么的?

JQuery是继prototype之后又一个优秀的Java库。它是轻量级的js库 ,它兼容CSS3,还兼容各种浏览器(IE6.0+, FF1.5+, Safari2.0+, Opera9.0+),jQuery2.0及后续版本将不再支持IE6/7/8浏览器。jQuery使用户能更方便地处理HTML(标准通用标记语言下的一个应用)、events、实现动画效果,并且方便地为网站提供AJAX交互。jQuery还有一个比较大的优势是,它的文档说明很全,而且各种应用也说得很详细,同时还有许多成熟的插件可供选择。jQuery能够使用户的html页面保持代码和html内容分离,也就是说,不用再在html里面插入一堆js来调用命令了,只需要定义id即可。

jQuery是当前很流行的一个Java框架,使用类似于CSS的选择器,可以方便的操作HTML元素,拥有很好的可扩展性,拥有不少插件。

jQuery可以快速找到文档中的html元素,并对其进行操作,如隐藏、显示、改变样式、添加内容等。能够方便的在页面上添加和移除html元素。这些功能虽然使用Java也能实现,但是jQuery绝对使这些工作变得更加简单。

jquery是什么类型的编程语言???

它不是什么编程语言,而是用javascript语言编写的一个框架,非要说它是语言,那它其实就是javascript。jquery的最大优势就是可以“写最少的代码,做最多的事”!

jquery编程是什么

jQuery是一个JavaScript库,它有助于简化JavaScript以及Asynchronous JavaScript XML(Ajax)编程。

与类似的JavaScript库不同,jQuery具有独特的基本原理,可以简洁地表示常见的复杂代码。学习jQuery基本原理,探索其特性和功能,执行一些常见的Ajax任务并掌握如何使用插件扩展jQuery。

算是原来的脚本语言吧。


文章名称:jquery在线编程,jquery操作html代码
文章路径:http://cdkjz.cn/article/dsdisjh.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220