2011年12月28日 星期三

相當於FLASH的XY軸

$('#xxx').offset().top
$('#xxx').offset().left
$('# xxx ').offset({ top: 10, left: 30 });

jquery 視窗寬高度

alert($(window).height()); //瀏覽器當前窗口可視區域高度

alert($(document).height()); //瀏覽器當前窗口文檔的高度

alert($(document.body).height());//瀏覽器當前窗口文檔body的高度

alert($(document.body).outerHeight(true));//瀏覽器當前窗口文檔body的總高度 包括border padding margin

alert($(window).width()); //瀏覽器當前窗口可視區域寬度

alert($(document).width());//瀏覽器當前窗口文檔對像寬度

alert($(document.body).width());//瀏覽器當前窗口文檔body的高度

alert($(document.body).outerWidth(true));//瀏覽器當前窗口文檔body的總寬度 包括border padding margin
資料來源http://chaowei.wordpress.com/2011/04/15/jq-%E5%8F%96%E5%BE%97%E5%BC%8F%E7%AA%97%E9%AB%98/

2011年12月22日 星期四

function裡藥用外部變數要在裡面加global

$count_title=0;
function for_count_use(){
global $count_title;//要用外部變數要這樣用
$count_title++;
echo $count_title;
}

php 絕對位置

//php用得絕對位置
$root_Path=$_SERVER['DOCUMENT_ROOT'].'/Houli/';
//HTML用的連結時的絕對路徑
$root_Path_html="http://localhost/Houli/";

//include時要用$root_Path(D:wamp/www/xxxx) ,src的HTML用法要$root_Path_html

2011年12月20日 星期二

2011年12月5日 星期一

偵測是否IPAD

//偵測是否IPAD
//返回boolean值 True 或者 False
function is_IPhoneOrIPad(){
return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1) );
}

IE8無法吃JQUERY $無法定義或NULL

都會顯示$無法定義或NULL的話
請檢察
Check your script include tag, 
is it usingtype="application/javascript" src="/path/to/jquery"
change totype="text/javascript" src="/path/to/jquery"

IE9無法輸入且無法滾輪SUCK解決辦法

網際網路選項->安全性
取消勾選 [啟用受保護模式],按 [確定]。

來源
http://www.dotblogs.com.tw/chou/archive/2010/10/15/18362.aspx