2012年7月26日 星期四

【PHP】取得動態變數

$var1='王小明';
$var2='李大牛';

for ($i=1;$i<=2;$i++){
   echo ${'var'.$i}.'<br />';
}


結果:

王小明
李大牛

2012年7月24日 星期二

【JQuery】animate自訂動態效果

參考:http://webdesign.kerthis.com/jquery/jquery_effects

animate 這個函式可以讓你自行定義動態效果,其參數分別為:
參數型別說明
paramsOptions一組包含最終CSS樣式的{屬性:值}
durationString,Number三種預定的速度("slow", "normal", "fast"),或
動畫間隔的毫秒數值(如一秒、1000)
easingString緩和方式,預設是 linear 線性,還有 swing 可選
callbackFunction每個元素在完成動畫後要執行的函數
$("#go").click(function(){
  $("#block").animate({ 
    width: "70%",
    opacity: 0.4,
    marginLeft: "0.6in",
    fontSize: "3em", 
    borderWidth: "10px"
  }, 1500 );
});

練習:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh-tw">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<title>fly</title>
</head>
<body>
<div id="fly">click</div>
</body>
</html>

<script type="text/javascript">
$(document).ready(function(){
$("#fly").click(function(event){
alert('click');
$("#fly").animate(
{marginLeft:"300"},
400,
function(){alert('fly ok')}
);
})

});
</script>

【HTML】自動重整


<meta http-equiv="Refresh" content="300" >
<!-- 60000 millisecond -->