百度最新算法有:绿萝算法、石榴算法、原创星火计划、冰桶算法、白杨算法、蓝天算法、轻舟算法、飓风算法。清风算法。
一、绿萝算法
算法内容:为了打击买卖外链、批量群发外链的行为。
主要打击的网站类型有:超链中介、出售链接网站、购买链接的网站。
本函数功能为ASP通过AJAX XMLHTTP方式获取百度或中IP查询的地理位置信息。
百度接口调用方式:gw_gethttpstr(0,ip)
IP138接口调用方式:gw_gethttpstr(1,ip)
例如:
% dimip:ip=request.servervariables(REMOTE_ADDR)获取客户端IP地址 response.write(您的IP为:ip/) response.write(地理位置为【百度接口】:gw_gethttpstr(0,sip)/) response.write(地理位置为【IP138接口】:gw_gethttpstr(1,sip)/) %
scriptlanguage=javascripttype=text/javascript functionjinzhi_chg(){ varnum=document.getElementById(in).value; vartype=document.getElementById(type); vartynum,to; for(vari=0;itype.length;i++){ if(type[i].selected) tynum=parseInt(type[i].value); } switch(tynum){ case(1):to=parseInt(num).toString(2);break; case(2):to=parseInt(num).toString(8);break; case(3):to=parseInt(num).toString(16);break; case(4):to=parseInt(num,2);break; case(5):to=parseInt(num,8);break; case(6):to=parseInt(num,16);break; case(7):to=parseInt(num,2).toString(8);break; case(8):to=parseInt(num,8).toString(2);break; case(9):to=parseInt(num,2).toString(16);break; case(10):to=parseInt(num,16).toString(2);break; case(11):to=parseInt(num,8).toString(16);break; case(12):to=parseInt(num,16).toString(8);break; } document.getElementById(out).value=to; } /script selectname=typeid=type optionvalue=1十进制转二进制/option optionvalue=2十进制转八进制/option optionvalue=3十进制转十六进制/option optionvalue=4二进制转十进制/option optionvalue=5八进制转十进制/option optionvalue=6十六进制转十进制/option optionvalue=7二进制转八进制/option optionvalue=8八进制转二进制/option optionvalue=9二进制转十六进制/option optionvalue=10十六进制转二进制/option optionvalue=11八进制转十六进制/option optionvalue=12十六进制转八进制/option /select 输入值:inputtype=textid=in/ 输出值:inputtype=textid=outdisabled=disabled/ inputtype=buttonvalue=开始转换onclick=jinzhi_chg()/
发布时间:2016年11月24日 | 评论:3 | 浏览: | 标签:JavascriptJS教程
% dimstr:str=大发 response.write(tounicode(str)/) response.write(unicodeto(tounicode(str))/) functiontounicode(str)中文转unicode tounicode= dimi fori=1tolen(str) asc函数:返回字符串的第一个字母对应的ANSI字符代码 AscW函数:返回每一个GB编码文字的Unicode字符代码 hex函数:返回表示十六进制数字值的字符串 tounicode=tounicodeuLCase(Right(0000Cstr(hex(AscW(mid(str,i,1)))),4)) next endfunction u51ccu9648u4eaeu535au5ba2 functionunicodeto(str)unicode转中文 str=replace(str,u,) unicodeto= dimi fori=1tolen(str)step4 cint函数:将Variant类型强制转换成int类型 chr函数:返回数值对应的ANSI编码字符 ChrW函数:返回数值对应的Unicode编码字符 unicodeto=unicodetoChrW(cint(Hmid(str,i,4))) next endfunction %
输出结果:
kindeditor上传图片后,自动缩放超出指定尺寸(宽高)的图片,不超过的则显示原图。
如下图中所示,指定宽度为600px,第一张小图宽不超过则显示原图,第二张大图宽超过则将宽缩放为600px。
发布时间:2016年11月23日 | 评论:3 | 浏览: | 标签:KindEditor编辑器文件操作文件上传
kindeditor点击上传图片按钮,默认显示标签为“本地上传”功能。实现效果如下图:
发布时间:2016年9月23日 | 评论:1 | 浏览: | 标签:KindEditor编辑器文件操作文件上传
kindeditor富文本编辑器点击上传图片按钮,在弹出的窗口中去掉上传网络图片的功能,只留下本地上传,如图:
发布时间:2016年9月22日 | 评论:0 | 浏览: | 标签:KindEditor编辑器文件操作文件上传
获取指定的A标签href属性的值,提取URL中的顶级域名或当前域名。具体代码如下:
aid=a1rel="nofollow" href=https://www.dominateseo.net/tags-189.htmltarget=_blankJS特效/a scriptlanguage=javascripttype=text/javascript alert(getdomain(1,a1));//弹窗输出域名,此处为获取顶级域名 functiongetdomain(typ,id){//参数:类型(0:当前域名,1:顶级域名),链接对象ID varurl=window.document.getElementById(id).href;//获取链接 if(typ==0){//获取当前域名,如:www.lingchenliang.com vara=document.createElement(a); a.rel="nofollow" href=url; url=a.hostname; }else{//获取顶级域名,如:lingchenliang.com //使用正则表达式 url=url.replace(/.+[./]([A-z]+.[A-z]+)/[^/].+/,$1); } returnurl;//返回域名值 } /script
发布时间:2016年9月20日 | 评论:0 | 浏览: | 标签:JavascriptJS特效
一、获取元素的行内样式
varobj=document.getElementById(test); alert(obj.height+n+obj.width);//200px200pxtypeof=string只是将style属性中的值显示出来
二、获取计算后的样式
发布时间:2016年9月20日 | 评论:0 | 浏览: | 标签:JavascriptJS特效
可以格式化为任意位数分隔的格式规范,间隔符只能为-英文减号或 英文空格。
scriptlanguage=javascript //函数功能:格式化手机号码和400电话格式 //参数:要格式化的字符对象ID,存放新值的对象ID,字符串格式规则(如3-4-4、334) //制作:大发(QQ:57404811) functionformatmobile(id,id2,str){ varnum=trim(window.document.getElementById(id).value);//获取号码并去左右空格 varrenum=;//函数返回对象 vararr=newArray(); vari,m=0,n; if(str.indexOf(-)-1){ arr=str.split(-); for(i=0;iarr.length;i++){ n=m+Number(arr[i]); renum+=num.substring(m,n); if(iarr.length-1)renum+=-; m=n; } }else{ arr=str.split(); for(i=0;iarr.length;i++){ n=m+Number(arr[i]); renum+=num.substring(m,n); if(iarr.length-1)renum+=; m=n; } } window.document.getElementById(id2).innerHTML=renum; } functiontrim(str){//删除左右两端的空格 returnstr.replace(/(^s*)|(s*$)/g,);//过滤首尾空格为空 } /script 手机号:inputtype=textname=mobileid=mobilevalue=13023105435/ 格式化后:spanid=fmm/span inputtype=buttonvalue=3-4-4格式onClick=javascript:formatmobile(mobile,fmm,3-4-4);/ inputtype=buttonvalue=344格式onClick=javascript:formatmobile(mobile,fmm,344);/ / 400电话:inputtype=textname=400telid=400telvalue=4008888888/ 格式化后:spanid=fmm2/span inputtype=buttonvalue=3-3-4格式onClick=javascript:formatmobile(400tel,fmm2,3-3-4);/ inputtype=buttonvalue=334格式onClick=javascript:formatmobile(400tel,fmm2,334);/ inputtype=buttonvalue=3-4-3格式onClick=javascript:formatmobile(400tel,fmm2,3-4-3);/ inputtype=buttonvalue=3-5-2格式onClick=javascript:formatmobile(400tel,fmm2,3-5-2);/ inputtype=buttonvalue=3-2-5格式onClick=javascript:formatmobile(400tel,fmm2,3-2-5);/ /
发布时间:2016年9月19日 | 评论:0 | 浏览: | 标签:Javascript格式化获取字符串
去除字符串左右两边的空格,在vbscript里面可以使用 trim函数,但在js中却没有这个内置方法,需要自己写代码。下面的实现方法用到了正则表达式。
第一种:写成类的方法
scriptlanguage=javascripttype=text/javascript String.prototype.trim=function(){//过滤首尾空格 returnthis.replace(/(^s*)|(s*$)/g,); } /script
调用方式:
发布时间:2016年9月19日 | 评论:0 | 浏览: | 标签:Javascript格式化获取字符串
scriptlanguage=javascript //函数功能:求N个数字的最大公约数和最小公倍数 //参数:数字集合(间隔符使用英文逗号,如:16,24) //调用方式:参照下方求两位数字和三位数字的最大公约数和最小公倍数案例 //制作:大发(QQ:57404811) functiongetGCDLCM(str){ vararr=eval([+str+]); varmax=Math.max.apply(null,arr); varmin=Math.min.apply(null,arr); varGCDLCM=newObject();//函数返回对象 GCDLCM.str=str;//输入的数字集合 GCDLCM.num=arr.length;//数字总个数 vari,j,ifstr=; for(j=0;jarr.length;j++){ ifstr+=arr[j]+1; if(jarr.length-1)ifstr+=|| } if(eval(ifstr)){ GCDLCM.GCD=-1;//最大公约数 GCDLCM.LCM=-1;//最小公倍数 returnGCDLCM; } //求最大公约数 for(i=min;i0;i--){ ifstr=; for(j=0;jarr.length;j++){ ifstr+=arr[j]+%+i+==0; if(jarr.length-1)ifstr+= } if(eval(ifstr)){ GCDLCM.GCD=i;//最大公约数 break; } } //求最小公倍数 varn=1; for(j=0;jarr.length;j++){n=n*arr[j];} for(i=max;i=n;i++){ ifstr=; for(j=0;jarr.length;j++){ ifstr+=i+%+arr[j]+==0; if(jarr.length-1)ifstr+= } if(eval(ifstr)){ GCDLCM.LCM=i;//最小公倍数 break; } } returnGCDLCM; } //例1:求两个数的最大公约数和最小公倍数 varresult=getGCDLCM(16,24); window.document.write(您要查最大公约数和最小公倍数的数字为:+result.str+/); window.document.write(数字个数为:+result.num+个/); window.document.write(最大公约数为:+result.GCD+/); window.document.write(最小公倍数为:+result.LCM+/); //例2:求三个数的最大公约数和最小公倍数 varresult=getGCDLCM(16,24,96); window.document.write(您要查最大公约数和最小公倍数的数字为:+result.str+/); window.document.write(数字个数为:+result.num+个/); window.document.write(最大公约数为:+result.GCD+/); window.document.write(最小公倍数为:+result.LCM+/); /script
发布时间:2016年9月18日 | 评论:0 | 浏览: | 标签:Javascript算法
scripttype=text/javascript jishu(); functionjishu(){//求奇数 varstr=,n=0; for(vari=1;i=100;i++){ if(i%2!=0){ str=str+i+,;//将奇数连到一个字符串中 n++;//奇数个数+1 } } window.document.write(1-100间的奇数(单数)总数为:+n+个/); window.document.write(1-100间的奇数(单数)分别为:+str.substr(0,str.length-1)+/); } oushu(); functionoushu(){//求偶数 varstr=,n=0; for(vari=1;i=100;i++){ if(i%2==0){ str=str+i+,;//将偶数连到一个字符串中 n++;//偶数个数+1 } } window.document.write(1-100间的偶数(双数)总数为:+n+个/); window.document.write(1-100间的偶数(双数)分别为:+str.substr(0,str.length-1)+/); } jioushu(100);//输出1到100间的奇偶数 functionjioushu(n){//求偶奇数 varstr1=,str2=,n1=0,n2=0; for(vari=1;i=n;i++){ if(i%2!=0){ str1=str1+i+,;//将奇数连到一个字符串中 n1++;//奇数个数+1 }else{ str2=str2+i+,;//将偶数连到一个字符串中 n2++;//偶数个数+1 } } window.document.write(1-100间的奇数(单数)总数为:+n1+个/); window.document.write(1-100间的奇数(单数)分别为:+str1.substr(0,str1.length-1)+/); window.document.write(1-100间的偶数(双数)总数为:+n2+个/); window.document.write(1-100间的偶数(双数)分别为:+str2.substr(0,str2.length-1)+/); } /script
发布时间:2016年9月18日 | 评论:0 | 浏览: | 标签:Javascript算法
scripttype=text/javascript heshu(); functionheshu(){ varstr=,n=0; for(vari=1;i=100;i++){ varm=0;//非合数 for(varj=2;ji;j++){ if(i%j==0){ m=1;//合数 break; } } if(m==1i!=2){ str=str+i+,; n++;//合数个数+1 } } window.document.write(1-100间的合数总数为:+n+个/); window.document.write(1-100间的合数分别为:+str.substr(0,str.length-1)+/); } /script
发布时间:2016年9月18日 | 评论:0 | 浏览: | 标签:Javascript算法