2013年8月14日 星期三

Get viewport size (Nice)


var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
alert(x);
alert(y);


Reference url: http://stackoverflow.com/questions/3437786/how-to-get-web-page-size-browser-window-size-screen-size-in-a-cross-browser-wa

2013年7月31日 星期三

Post data to a new window with full screen

Javascript Example:


function postDataToNewWindow() {
var myform = document.createElement("form");
myform.setAttribute("method", "post");
myform.setAttribute("action", "verifyCredential.asp");
myform.setAttribute("target", "_custom");

var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "credential");
hiddenField.setAttribute("id", "credential");
hiddenField.setAttribute("value", "2.0");

myform.appendChild(hiddenField);
document.body.appendChild(myform);
window.open("", "_custom", "fullscreen=yes");
myform.submit();
}


2010年9月21日 星期二

使用 jquery 設定 tag 的屬性值

設定 mobile 欄位為唯讀
$("#mobile").attr('disabled', true);



判斷 checkbox 欄位是否被勾選
$("#checkbox_id").attr('checked');

java 編譯時出現 "unchecked call to put(K,V)..." 的警告訊息

程式碼 Map result = new HashMap(); 在編譯時出現以下的警告訊息
warning: [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Map

解決方法,將程式碼改成以下的方式
Map<Object,Object> result = new HashMap<Object,Object>();

2010年9月20日 星期一

2010年9月16日 星期四

使用 NetBeans 在 Mac 上開發 java web application 時遇到的問題

Q: 連線 MySQL 時出現 "Host 192.168.232.108 is not allowed to connect to this MySQL server"
A:
1. 開啟 Server 上的 MySQL Administrator
2. 選擇 User Administration
3. root 帳號按右鍵選擇 Add host from which the user can connect
4. 192.168.232.108 加入

Q: 連線 MySQL 時出現 "Access denied for user 'root'@'192.168.232.108' to database 'jrsysradius'"
A:
1. 開啟 Server 上的 MySQL Administrator
2. 選擇 User Administration
3. 選擇 root 帳號所使用的 Host 名稱
4. 將要使用的 database 權限加入 Assigned Privileges

在 Mac 上安裝 Tomcat 的方法

參考網址
http://developer.apple.com/internet/java/tomcat1.html

Java and Tomcat on Mac OS X, Part I
Java and Tomcat on Mac OS X, Part II