好用的放大鏡

之前出席微軟的研討會上看到講師很輕易的放大縮小桌面的控制項,
當下就很好奇的問朋友:"Windows按甚麼可以這樣來Present?",
結果朋友說:"好像是Ctrl+….",
後來測試後發現不行~ = = 原來這不是Windows內建的功能,
而是第三方軟體的功能, 叫做: ZoomIt.

真的很方便, 在教學的時候特別好用, 還可以用滑鼠在上面寫字喔~
您也可以自訂熱鍵, 以便於操作.

已經在Windows 7, Windows Vista, Windows XP上測試, 都沒有相容性問題,
也不用特別安裝, 下載後只要Agree就可以開始使用.

下載網址: http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx

預設熱鍵: Ctrl+1, Ctrl+2, Ctrl+3, Ctrl+4

這樣以後Present就方便多了, 也比較能夠讓聽眾更加清楚您所指的方向.
小小的控制項, 不用再讓聽眾看得很吃力了~

在網路上找到的blink不是只能用於IE就是只相容於FF, 於是自己嘗試寫了一個JavaScript Blink的功能.
在IE8 及FF測試都沒問題. 閃爍的頻率在SetTimeout裡面可以設定, 1000表示1秒, 2000為2秒, 以此類推.




征才 


剛在JavaScript寫程式時,
發現我的Ajax功能在FireFox可以跑成功, Firebug也偵測不出問題,
但用IE時卻出現錯誤, 顯示說某某行找不到物件.
後來去找了很久才知道原來問題出在一個平時很少注意的地方:

乍看之下可能會覺得以上兩行沒有甚麼差別, 但其實問題就在type的部分,
在FF是可以辨識成功的, 但在IE(測試環境IE8)的情況下就讀取不到Javascript.
所以以後要多注意囉.

PHP的File Upload功能固然強大, 但要滿足大量檔案上傳的需求仍需要搭配AJAX或是Flash object, 這篇文章就是要介紹一個好用的Flash Uploader, 讓你可以直接從Windows, 在同一個目錄下選取要上傳的檔案, 達成輕鬆上傳的目的.

SwfUpload

官方網站: http://swfupload.org/

範例: http://demo.swfupload.org/v220/index.htm

index.php FLASH檔案上傳的頁面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5″ />
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="default.css" rel="stylesheet" type="text/css" />
<title>測試</title>
<script type="text/javascript" src="swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/swfupload.swfobject.js"></script>
<script type="text/javascript" src="js/swfupload.queue.js"></script>
<script type="text/javascript" src="js/fileprogress.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
var swfu;

SWFUpload.onload = function () {
var settings = {
flash_url : "swfupload/swfupload.swf",
upload_url: "upload.php", //負責處理上傳的PHP檔案
post_params: {
"PHPSESSID" : "NONE",
"HELLO-WORLD" : "Here I Am",
".what" : "OKAY"
},
file_size_limit : "100 MB",
file_types : "*.*",
file_types_description : "All Files",
file_upload_limit : 100,
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,

// Button Settings
button_image_url : "images/XPButtonUploadText_61x22.png",
button_placeholder_id : "spanButtonPlaceholder",
button_width: 61,
button_height: 22,

// The event handler functions are defined in handlers.js
swfupload_loaded_handler : swfUploadLoaded,
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete,    // Queue plugin event

// SWFObject settings
minimum_flash_version : "9.0.28″,
swfupload_pre_load_handler : swfUploadPreLoad,
swfupload_load_failed_handler : swfUploadLoadFailed
};

swfu = new SWFUpload(settings);
}

</script>

</head>

<body>

<form id="form1″ action="index.php" method="post" enctype="multipart/form-data">
<div id="divSWFUploadUI">
<div class="fieldset  flash" id="fsUploadProgress">
<span class="legend">Upload Queue</span>
</div>
<p id="divStatus">0 Files Uploaded</p>
<p>
<span id="spanButtonPlaceholder"></span>
<input id="btnCancel" type="button" value="Cancel All Uploads" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;" />
<br />
</p>
</div>
<noscript>
<div style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966;  padding: 10px 15px;">
We’re sorry.  SWFUpload could not load.  You must have JavaScript enabled to enjoy SWFUpload.
</div>
</noscript>
<div id="divLoadingContent" class="content" style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
SWFUpload is loading. Please wait a moment…
</div>
<div id="divLongLoading" class="content" style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
SWFUpload is taking a long time to load or the load has failed.  Please make sure that the Flash Plugin is enabled and that a working version of the Adobe Flash Player is installed.
</div>
<div id="divAlternateContent" class="content" style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
We’re sorry.  SWFUpload could not load.  You may need to install or upgrade Flash Player.
Visit the <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe website</a> to get the Flash Player.
</div>
</form>

</body>

</html>

upload.php , 負責處理上傳後的PHP

$upload_name = "Filedata";

if(isset($_FILES[$upload_name])) {

$filename = $_FILES[$upload_name]['name'];
copy($_FILES[$upload_name]['tmp_name'], $filename);

}