中山php|最优网络中山做网站 中山php建站

最优良人

Category Page for: 网站前端

用新浪搜狐腾讯jS接口取客户端IP及省份城市

2013/05/13 at 12:56 » Comments (689)

新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 新浪多地域测试方法:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=218.192.3.42 搜狐IP地址查询接口(默认GBK):http://pv.sohu.com/cityjson 搜狐IP地址查询接口(可设置编码):http://pv.sohu.com/cityjson?ie=utf-8 搜狐另外的IP地址查询接口:http://txt.go.sohu.com/ip/soip 腾讯的接口:http://fw.qq.com/ipaddress (腾讯的接口原本是最好用的,可现在打不开啦) 上面的接口中新浪的是js接口说明: <script type="text/javascript" src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js" charset="gb2312"></script> <script type="text/javascript"> function ipmsg() { var ss = remote_ip_info['country']  + remote_ip_info['province']+ remote_ip_info['city']; document.getElementByIdx_x_x("<%=HiddenField1.ClientID %>").value = ss; } </script>   more »

select下拉菜单实现友情链接跳转

2012/10/07 at 16:47 » Comments (399)

<select name="select" class="home_left_select" onchange="window.location=this.options[this.selectedIndex].value"> <option value="#">友情链接</option> <option value="http://www.baidu.com">2</option> <option value="http://www.baidu.com">2</option> <option value="http://www.baidu.com">2</option> <option value="http://www.baidu.com">2</option> <option value="http://www.baidu.com">2</option> </select> 以上代码实现选中项跳转到指定链接 more »

JS获取file上传文件路径,后缀,大小,文件名

2012/08/16 at 11:58 » Comments (184)

/** *函数描述:获取input type=file的图像全路径 * @obj input type=file的对象 **/ function getFullPath(obj) { if(obj) { //ie if (window.navigator.userAgent.indexOf("MSIE")>=1) { obj.select(); return document.selection.createRange().text; } //firefox else if(window.navigator.userAgent.indexOf("Firefox")>=1) { if(obj.files) { return obj.files.item(0).getAsDataURL(); } return obj.value; } return obj.value; } }   <input type="file" onchange="document.getElementById('img').src=getFullPath(this);" >   =========================================================================     #判断IE还是Firefox function getFullPath(obj) { if(obj) { //ie if (window.navigator.userAgent.indexOf("MSIE")>=1) { obj.select(); return document.selection.createRange().text; } //firefox else if(window.navigator.userAgent.indexOf("Firefox")>=1) { if(obj.files) { return obj.files.item(0).getAsDataURL(); } return obj.value; } return obj.value; } }       #判断后缀名 function yulan(){ var filePath =getFullPath(document.getElementById('UpFile')); var fileText =filePath.substring(filePath.lastIndexOf("."),filePath.length); var ...more »

ie6实现div页面固定不动,纯CSS中使用expression兼容fix

2012/08/01 at 17:36 » Comments (437)

* html,* html body /* IE6 Fixed Position Jitter Fix */{background-image:url(about:blank);background-attachment:fixed;} * html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));} * html .fixed-right /* IE6 position fixed right */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));} * html .fixed-bottom /* ...more »

JS 把字符串转成整数的函数

2012/07/21 at 12:35 » Comments (459)

parseInt()把字符串转成整数 parseFloat()把字符串转成浮点数 js在处理变量的数学运算时一点要注意变量类型的转换 JS 字符串转整数 JS 字符串转整数方法主要有三种转换函数、强制类型 转换、利用js 变量弱类型转换。 1.转换函数: js 提供了parseInt()和parseFloat()两个转换函数。 前者把值转换成整 数,后者把值转换成浮点数。只有对String 类型调用这些方法,这两个函数才 能正确运行;对其他类型返回的都是NaN(Not aNumber)。 在判断字符串是否是数字值前,parseInt()和parseFloat()都会仔细分析 该字符串。 parseInt()方法首先查看位置0 处的字符,判断它是否是个有效数字;如 果不是,该方法将返回NaN,不再继续执行其他操作。但如果该字符是有效数 字,该方法将查看位置1 处的字符,进行同样的测试。这一过程将持续到发现 非有效数字的字符为止,此时 parseInt()将把该字符之前的字符串转换成数字。 例如,如果要把字符串"1234blue"转换成整数,那么parseInt()将返回 1234,因为当它检测到字符b 时,就会停止检测过程。 字符串中包含的数字字面量会被正确转换为数字,因此字符串"0xA"会被正 确转换为数字10。 ...more »

在线客服代码,qq,msn,skype,淘宝旺旺,阿里巴巴贸易通,雅虎通

2012/06/05 at 17:43 » Comments (427)

1.QQ在线咨询代码 (qq在线交谈代码/qq在线客服代码/qq在线状态代码/qq在线客服代码) (将66757924换成你的号码,site后面换成你的网站就可以了) <a target="blank" href="http://wpa.qq.com/msgrd?V=1&Uin=66757924&Site=服务易& Menu=yes"><img border="0" SRC=http://wpa.qq.com/pa?p=1:66757924:6 alt="点击这里给我发消息" align="absmiddle"></a> 2.MSN在线咨询代码 用的时候把[邮件地址]写成你的MSN账号,不要方括号,用链接即可,如 <a target="blank" href="msnim:chat?contact=sliang@zui88.com">MSN在线客服</a> 3.skype在线状态代码生成 将yisung换成你的skype ID就可以了,需要在skype个人账户里设置对任何人显示状态 <a target="blank" href="skype:mengsajewel?call"><img src=http://mystatus.skype.com/smallclassic/yisung style="border: none;" alt="Call me!" /></a> 更多的skype在线状态代码生成样式,请查看skype的官方网站 http://www.skype.com/share/buttons/ 4.淘宝旺旺 <a target="_blank" href="http://amos1.taobao.com/msg.ww?v=你的旺旺名=1" ...more »

文字图片向上滚动的JS代码

2012/05/29 at 11:38 » Comments (193)

<div id="demo"> <div id="demo1"> <ul> <li> 文字图片内容   </li> </ul> </div> <div id="demo2"></div>   <script type="text/javascript"> var speed=10; var FGDemo=document.getElementById('demo'); var FGDemo1=document.getElementById('demo1'); var FGDemo2=document.getElementById('demo2'); FGDemo2.innerHTML=FGDemo1.innerHTML function Marquee1(){ if(FGDemo2.offsetHeight-FGDemo.scrollTop<=0) FGDemo.scrollTop-=FGDemo1.offsetHeight else{ FGDemo.scrollTop++ } } var MyMar1=setInterval(Marquee1,speed) FGDemo.onmouseover=function() {clearInterval(MyMar1)} FGDemo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)} </script> </div> more »

ie6下,浮动的li里面文字不换行

2012/05/19 at 17:46 » Comments (192)

在ie6下,浮动的li里面文字在结尾出宽度不够,但是不自动换行,而是往下挤,使后面的li乱掉。 解决的方法是在li里面定义样式 white-space: nowrap; more »

最简单的设为首页,加入收藏代码

2012/05/05 at 18:20 » Comments (45)

只要一句代码,可以实现设为首页,加入收藏的功能,并且通用其他网站,自动识别标题和链接,不用手动修改。但是只兼容ie浏览器。 <a href="#" onClick="this.style.behavior='url(#default#homepage)'; this.setHomePage(window.location.href);">设为首页</a> | <a href="#" onClick="window.external.addFavorite(window.location.href,document.title)">加入收藏</a> more »

CSS border-collapse 属性,细边线table表格样式

2012/03/08 at 14:56 » Comments (374)

border-collapse 属性设置表格的边框是否被合并为一个单一的边框,还是象在标准的 HTML 中那样分开显示。 可能的值 值 描述 separate 默认值。边框会被分开。不会忽略 border-spacing 和 empty-cells 属性。 collapse 如果可能,边框会合并为一个单一的边框。会忽略 border-spacing 和 empty-cells 属性。 inherit 规定应该从父元素继承 border-collapse 属性的值。 细边线table表格样式 table {width:100%; border:1px solid #ccc; border-collapse:collapse;} table td {border:1px solid #ccc; border-collapse:collapse; padding:10px 15px; color:#999;} more »