1、为父级或相邻的元素增加position: absolute或overflow: hidden或display: inline-block;
2、为父级或相邻的元素中间增加
;

Tagged with:  

html实现禁止右键、选中效果

On 07/31/2010, in (x)html/css, by kilobug
document.oncontextmenu = function(){return false;} 
document.onselectstart = function(){return false;}

<div oncontextmenu="return false;" onselectstart="return false;"></div>

而Firefox则只能通过CSS禁止,不支持禁止右键、选中事件。

-moz-user-focus:ignore;
-moz-user-input:disabled;
-moz-user-select:none;
Tagged with:  
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="395" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="地址" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="false" /><embed type="application/x-shockwave-flash" width="480" height="395" src="地址" allowfullscreen="false" wmode="transparent"></embed></object>

PS:如使用透明属性,上下左右键会导致页面滚动;

Tagged with:  

正则表达式匹配:多层嵌套标签

On 07/31/2010, in regular, by kilobug
/\{([a-z_]\w+)(\s([^\}]+))?\}((((?!\7)[\s\S])*)|(?R))(\{/\1\s*\})/ig

注:php不支持,很可惜,在正则调试工具上能正常运行;

Tagged with:  

正则表达式匹配:网址

On 07/31/2010, in regular, by kilobug

2010-7-14 10:16 增强IP判断

/^((ht|f)tps?\:\/\/)?(([a-z\d](\-?[a-z\d]+)*\.)+[a-z]{2,4}|(2[0-5]{2}|1\d{2}||[1-9]?\d|\d)(\.(2[0-5]{2}|1\d{2}|[1-9]?\d|\d)){3}|\d+)(\:\d{1,5})?(\/[\s\S]*)?$/i

Continue reading »

Tagged with:  

php匹配utf-8编码的中文的正则

On 07/31/2010, in php, regular, by kilobug
/[\x{4e00}-\x{9fa5}]+/i
Tagged with:  

通用的IP转数字算法

On 07/31/2010, in arithmetic, by kilobug

例子:116.55.227.84

原算法:

116 * 256 * 256 * 256 + 55 * 256 * 256 + 227 * 256 + 84

精简后:

256 * (227 + 256 * (55 + 256 * 116)) + 84

注:在php中,可以用自带函数ip2long和long2ip进行IP与数字互换;

Tagged with:  
Tagged with:  

滔滔http的API

On 07/31/2010, in api, by kilobug

http://www.taotao.com/cgi-bin/msgj?qq=498972891&num=10

参数说明:
qq:调用的QQ号码
num:调用条数

返回结果:

doApi({"posts":[{"cn":"歌,你知道的太多了...","id":"19595212831","sr":3,"time":"7,2010-03-23 19:34:32"}],"ret":0,"total":120,"type":0,"ui":{"lrank":0,"name":"Kilobug","qq":498972891,"rank":0,"rec":"","usn":6538331}})

注:适合以jsonp的方式来调用

Tagged with:  
Tagged with:  

无觅相关文章插件,快速提升流量