Bài đăng

Đang hiển thị bài đăng từ Tháng 9, 2014

regex match mac address

/(([0-9A-F]{2}[:-]){5}[0-9A-F]{2})/

regex get n word first

/(\S+\s+){10,40}/

php regex match is absolute url

Tìm các url có "/" đầu tiên if (preg_match('/^\//', $url, $out)) $url = STATIC_URL.$url;

js auto center element

var frm = $(' '); var modal=$('<div class="modal"></div>'); $(modal).css({width: '100%', height:2000,top:0, left:0,position:'absolute','z-index': '998',background: '#999','opacity' :'0.8'}); $(modal).click(function (){ $(frm).remove(); $(this).remove(); }); var h,w; h = (cb_widget_config.height) ? cb_widget_config.height:300; w = (cb_widget_config.width) ? cb_widget_config.width:500; frm.css({'height':h, 'width':w, 'position':'fixed','z-index': '999'}); $('body').append(modal); $('body').append(frm); var auto_center = function(e){ var w=$(window).width(); var h=$(window).height(); $(e).css({ 'left':(w-$(e).width())/2, 'top':(h-$(e).height())/2, }); } auto_center(frm); window.onresize= function (){auto_center(frm);}