例如:
2014(年)+001(款號)+01(規格) = 201400101(產品編號)
此時我們會希望用款號來把相同款式的商品群組起來,秀一筆就好,GROUP BY可以搭配SUBSTR()來實現這效果,實際實作方式如下
[……]
[……]
:focus // 焦點
:active // 按下
:hover // 滑出
:disabled // 停用
<style type=”text/css”>
/* 原始 */
input[type=”button”]{
background:#F00;
border:2px solid #F00;
padding:10px;
}
/* 滑入 */
input[type=”button”]:hover{
background:#0F0;
background:inherit;
}
/* 按下 */
input[type=”button”]:active{
background:#00F;
background:inherit;
}
/* 焦點 */
input[type=”button”]:focus{
border:2px solid #00F;
background:inherit;
}
/* 停用 */
input[type=”submit”]:disabled{
background:#EBEBEB;
border:2px solid #ccc;
color:#999;
padding:10px;
}
</style>
<input type=”button” name=”button” id=”button” value=”正常按鈕” />
<input type=”submit” name=”button” id=”button” value=”停用按鈕” disabled=”disabled” />[……]
// 元素停用
// 元素啟用
$(‘.select’).removeAttr(‘disabled’);[……]
fancybox plugin 自適應iframe內容尺寸 fancybox iframe auto width height
本篇使用 jquery-1.11.0 & fancyBox-v2.0.6 請先確認您的版本
jQuery代碼如下,主要是為fancybox加上beforeShow事件的callback,在iframe頁面載入後去抓其內容的寬度及高度。
重點在這 – iframe中的頁面一定要定義其 <html>及<body>的寬度、高度,高度可設為auto
範例如下,將下列代碼置於<head>及<body>中間,父頁面才有辦法去抓到頁面的寬度,以設定ifreme的尺寸
<style type=”text/css”>
/* iframe 頁面 */
html,body{
margin:0;
padding:0;
width:700px;
height:auto;
}
</style>[……]
[……]
})
//相對位置
})[……]
2.
排序點分式IP3.
將某列中特定值排在最前4.
將某列內容按照使用者自訂的順序排序5.
對枚舉類型排序6.
按csv類型的字串的某字串排序[……]
/* https://vector.cool */ $time = strtotime('2015-03-04 12:03:25'); //output : 1425441805
一、慢慢算
/* https://vector.cool */ date_default_timezone_set("Asia/Taipei"); $next_Month = 30*24*60*60;//30天*24小時*60分*60秒 echo date('Y-m-d',strtotime('2015-03-04 12:03:25')+$next_Month);
二、使用 mktime()
/* https://vector.cool */ date_default_timezone_set("Asia/Taipei"); $date=date("Y-m-d",mktime(hr,min,sec,mon,day,year)) //例如:今天再加5天 date("y-m-d",mktime(0,0,0,date("m"),(date("d")+5),date("y")))
Reference:http://php.net/manual/zh/function.mktime.php
三、使用 strtotime()
strtotime()這東西比我想像聰明多了耶
/* https://vector.cool */ date_default_timezone_set("Asia/Taipei"); echo strtotime("now")."<br/>"; echo strtotime("10 September 2000")."<br/>"; echo strtotime("2020-09-29 +1 day")."<br/>"; echo strtotime("+1 day")."<br/>"; echo strtotime("+1 week")."<br/>"; echo strtotime("+1 week 2 days 4 hours 2 seconds")."<br/>";; echo strtotime("next Thursday")."<br/>"; echo strtotime("last Monday")."<br/>";
Reference:http://php.net/manual/zh/function.strtotime.php
[……]