2010年4月27日 星期二

提示清單

引入jquery .js檔

<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="jquery.autocomplete.js"></script>

html 輸入方塊給個ID

<input type="text" name="t1" id="t1" />

Query碼

var data = ['台北市中正區','台北市大同區','台北市中山區','台北市松山區','台北市大安區'];
$("#t1").autocomplete(data, {matchContains: true});


參考文獻:http://jsgears.com/viewthread.php?tid=114

2010年4月25日 星期日

大膽劉

4/16

今天是正式上班的第一天,

一早我就去人事部找邵經理報到,

聊了一會然後他就帶我到處去閒晃認識一下環境,

這工廠還真是超級大的說,目前人員短缺雍有1500名工人左右,

聽邵經理說早期工人最多招募達8000名,還不賴猛的嘛 !!

晚上一下班劉大膽就溜出廠外去溜搭溜搭,

看看傳說中治安超差的東莞市,走在路上說真的我心裡是挺害怕的。

路上人超多,個個面目猙獰、餓如豺狼,

稍微走到較暗的巷口就會有很多亮起的眼光射向我而來,

就像夜晚的黑貓隨時注意我的動向。

而我只能小心翼翼的慢慢向前走,

深怕稍有不甚就會淪為入虎口的羊兒。

2010年4月21日 星期三

啟程

4/15

今天是前往大陸的第一天 ,

外面的天氣出著太陽卻下著綿綿細雨 ,

就像我的心情一樣 ,

有些興奮卻又有點感傷與不捨 。

2:10分的飛機 ,飛出台灣的領空 ,

大約2小時候踏上對岸展開新的旅程 。

2010年2月26日 星期五

新開式窗

href="JavaScript:void(0);
讓滑鼠有手指的樣子



<a href="JavaScript:void(0);" onclick="window.open('http://www.top-aplus.com/','','scrollbars=yes,resizable=yes');"><img src="/pub/img/front/aplus.gif "/></a>

2010年2月22日 星期一

動態換圖




<script language="javascript" type="text/javascript">
function view(t){
switch(t){
case 1:
document.getElementById("img").innerHTML = '<img src="/pub/archive/pics/<%if $this.veryhot_folder.0.Img != ""%><%$this.veryhot_folder.0.Img%><%else%>pic_no_pix_s.jpg<%/if%>" width="360" style="border:4px solid #FFF;">';
break;
case 2:
document.getElementById("img").innerHTML = '<img src="/pub/archive/pics/<%if $this.veryhot_folder.0.Pic1 != ""%><%$this.veryhot_folder.0.Pic1%><%else%>pic_no_pix_s.jpg<%/if%>" width="360" style="border:4px solid #FFF;">';
break;
case 3:
document.getElementById("img").innerHTML = '<img src="/pub/archive/pics/<%if $this.veryhot_folder.0.Pic2 != ""%><%$this.veryhot_folder.0.Pic2%><%else%>pic_no_pix_s.jpg<%/if%>" width="360" style="border:4px solid #FFF;">';
break;
case 4:
document.getElementById("img").innerHTML = '<img src="/pub/archive/pics/<%if $this.veryhot_folder.0.Pic3 != ""%><%$this.veryhot_folder.0.Pic3%><%else%>pic_no_pix_s.jpg<%/if%>" width="360" style="border:4px solid #FFF;">';
break;
}
}
</script>



<div style=" float:left;width:120px; height:120px;border:1px solid #CACACA; margin:2px;">
<a href="javascript:view(1)"><img height="120" width="120" src="/pub/archive/pics/<%if $index.Img != ""%><%$index.Img%><%else%>pic_no_pix_s.jpg<%/if%>" style="cursor: pointer;"></a></div>
<div style=" float:left;width:120px; height:120px;border:1px solid #CACACA; margin:2px;">
<a href="javascript:view(2)"><img height="120" width="120" src="/pub/archive/pics/<%if $index.Pic1 != ""%><%$index.Pic1%><%else%>pic_no_pix_s.jpg<%/if%>" style="cursor: pointer;"></a></div>

2010年2月7日 星期日

匯率即時更新

$html_path                       設定要讀取的網頁
file_get_contents($html_path) 把讀趣的網頁轉成html存這字串中
highlight_string($result) 顯示html
eregi("123",$result.$temp) 把想要讀取的部分擷取出來
str_replace('123', '', $temp[0]);把不要的部分用空白取代

function exchange(){
$html_path = "http://consumer.chinatrust.com.tw/ch/int_rate/EX_RATE.html"; //國泰世華匯率
if ($html_path) {
$result = file_get_contents($html_path);
$result = iconv("big5","utf-8",$result);
//highlight_string($result); // 顯示html
}else {
//echo "錯誤 : 無法開啟網站!";
 exit();
}
eregi('人 民 幣 / CNY 4.5760', $result, $temp); //設定過濾條件


$exchange_rate = array();
$exchange_rate[1] = str_replace('人 民 幣 / CNY ', '', $temp[0]);

$rate = 1/floatval($exchange_rate[1]);

return $rate;
}


參考文獻: http://blog.roodo.com/nextstep/archives/185546.html

2009年12月18日 星期五

字串取代

字串取代



$originalString = "I like red cars, and I have a red car near my red bike.";
$newString = str_replace("red","green",$originalString);

echo $originalString."<br/>";
echo $newString."<br/>";

2009年12月2日 星期三

big5轉utf-8的最簡單方式

big5轉utf-8的最簡單方式,
就是用記事本開啟檔案,
檔案→另存新檔,


在最下面的編碼選項,
選擇utf-8,
按儲存,
即可完成big5轉utf-8

2009年12月1日 星期二

Smarty {foreach}巢狀迴圈

Smarty {foreach}巢狀迴圈


<%foreach from=$this.Order_list_Menu item=index key=key%>

<%foreach from=$this.Order_list_Menu.$key item=index2 key2=key2%>

<%/foreach%>

<%/foreach%>

取得SQL 時間區間

取得 30 天內的資料
TO_DAYS(NOW()) - TO_DAYS(A2.ModifyTime) <= 30