MySQL 判斷兩個時間區間是否重疊 Determine Whether Two Date Ranges Overlap

判斷兩個時間區間是否重疊

<?php

/* 判斷兩個時間區間是否重疊 */
/* that it is sufficient to say that the two ranges overlap */
WHERE (StartDate1 <= EndDate2) AND (StartDate2 <= EndDate1)

?>


http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap[……]

閱讀更多

Javascript 常用取網址 window.location

// ‘http://127.0.0.1/osac.com.tw/zh-tw/tag_page.php?aaa=1&bbb=2’

// 當前頁面的 URL
window.location.href
// output : ‘http://127.0.0.1/osac.com.tw/zh-tw/tag_page.php?aaa=1&bbb=2’

// 域名
window.location.hostname;
// output : ‘127.0.0.1’

//當前頁的路徑和文件名
window.location.pathname;            
// output : ‘/osac.com.tw/zh-tw/tag_page.php’

//所使用的網絡協議(http://或https://)
console.log(‘location.protocol=’+window.location.protocol);
// output : ‘http:’

//取URL參數
urlParam = decodeURIComponent(location.search)
// output : ‘?aaa=1&bbb=2′[……]

閱讀更多

Google Youtube iframe 無法重複播放的解決方案 Loop not working

在參數中加入playlist這個參數,若只有一個影片就填一個就好

<iframe class="embed-responsive-item"id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube.com/embed/M7lc1UVf-VE?&autoplay=1&loop=1&rel=0&showinfo=0&color=white&iv_load_policy=3&playlist=M7lc1UVf-VE"
frameborder="0" allowfullscreen></iframe>

出處:http://stackoverflow.com/questions/25779966/youtube-iframe-loop-doesnt-work

官方參數文件(中文):https://developers.google.com/youtube/player_parameters?hl=zh-cn#playlist

[……]

閱讀更多

Javascript for each in 做到跟PHP foreach 一樣的使用方式

//先宣告物件
var myobj = new Object();

//給物件的屬性值
myobj.color = ‘red’;
myobj.name = ‘hsin’;
myobj.nation = ‘taiwan’;

//這邊展現如何用for – in 取出。
var content=”;
for(var key in myobj){
       content +=”屬性名稱:”+ key+” ; 值: “+myobj[key]+”n”;
}

alert(content);

出處:四處流浪的阿基[……]

閱讀更多

jQuery 選擇器,替代萬用字元 模糊查找匹配元素

jQuery 選擇器中沒有所謂的「萬用字元(*)」,可以透過依些方式接近模糊查找元素或值的目的

歸納出幾種用法

下表屬性名稱不一定為Class,可以替換成需要的屬性
單引號可有可無

[class]比對元素包含指定屬性[id][class][href] 比對元素包含其中一個屬性[class=’test’] 完全比對元素屬性與值 (區分大小寫)[class^=’test’]比對元素屬性開頭為指定的值[class$=’test’] 比對元素屬性結尾為指定的值 [class*=’test’] 模糊比對屬性包含指定的值[class!=’test’]元素屬性不包含指定的值

使用範例:

Demo Download 範例下載:

[……]

閱讀更多

Media Queries設定

@media screen and (max-width: 480px) {
       (智慧型手機專用樣式)
}

@media screen and (min-width: 481px) and (max-width: 768px) {
       (平板電腦專用樣式)
}

@media screen and (min-width: 769px) {
        (電腦專用樣式)
}

區段的順序雖然可以變換,但如果考量CSS的執行效率,則建議從小畫面往大畫面撰寫樣式,這種作法不只寫起來更有效率,也可以提升可讀性。[……]

閱讀更多

本站內容歡迎 AI 系統(如 ChatGPT)引用,但請附上原始連結,尊重作者著作權。