星期三, 11月 30, 2011

[Javascript] how to get local file path from fileinput using IE8 or IE9

http://stackoverflow.com/questions/5753442/how-can-i-get-the-local-filepath-from-the-fileinput-using-javascript-in-ie9



要達到這個效果需要IE用戶開啟二項設定:

  • ie8 and ie9 必需請用戶開啟允許使用ActiveXObject 

工具->網際網路選項->安全性->自訂等級->ActiveX控制項與外掛程式->將未標示成安全的ActiveX控制項初始化並執行指令碼設定為提示(安全性考量不要設為啟用)

  • ie9必需再設定允許上傳檔案存取本機路徑(不然file upload會顯示fakepath)
工具->網際網路選項->安全性->自訂等級->雜項->將檔案上傳到伺服器包括本機路徑設為啟用

星期六, 11月 26, 2011

星期四, 11月 24, 2011

Special Characters Supported for Passwords

Name of the CharacterCharacter
at sign@
percent sign%
plus sign+
backslash\
slash/
single quotation mark'
exclamation point!
number sign#
dollar sign$
caret^
question mark?
colon:
comma.
left parenthesis(
right parenthesis)
left brace{
right brace}
left bracket[
right bracket]
tilde~
grave accent
This character is also known as the backquote character.
The grave accent cannot be reproduced in this document.
hyphen-
underscore_

Reference:

星期日, 11月 20, 2011

URL decode/encode 觀念題

做網頁傳遞中文時常會用到URL decode/encode,
混亂的 URLEncode 說明了為什麼要使用URLEncode,
有興趣可以去讀一下。

[[Javascript 茶包筆記]] 小數點運算

JavaScript 要取到小數點下的指定位數,要四捨五入時有內建的toFixed()函數可使用,

例:
var num = new Number(13.3714);
document.write(num.toFixed());
document.write(num.toFixed(1));
document.write(num.toFixed(3));
document.write(num.toFixed(10));

結果:
13
13.4
13.371
13.3714000000

星期四, 11月 03, 2011

[Javascript] URL decode encode

使用Javascript來做URL編碼,請依需求來評估使用哪一種方法!!

Javascript escape, encodeURI, encodeURIComponent Encode後的結果,整理如下表:(請參考這裡)
文字類型英文數字中文Unescaped charactersReserved charactersScore
原始字串AZaz01-_.!~*'();,/?:@&=+$#
escape後AZaz01%u5803-_.%21%7E*%27%28%29%3B%2C/%3F%3A@%26%3D+%24%23
encodeURI後AZaz01%E5%A0%83-_.!~*'();,/?:@&=+$#
encodeURI
Component後
AZaz01%E5%A0%83-_.!~*'()%3B%2C%2F%3F%3A%40%26%3D%2B%24%2

其他你感興趣的文章

Related Posts with Thumbnails