顯示具有 JavaScript 標籤的文章。 顯示所有文章
顯示具有 JavaScript 標籤的文章。 顯示所有文章

2011年11月11日 星期五

JavaScript 判斷是什麼瀏覽器


Android
var isAndroid = navigator.userAgent.toLowerCase().match(/android/i);

iPad
var isiPad = navigator.userAgent.match(/iPad/i)

iPhone
var isiPhone = navigator.userAgent.match(/iPhone/i)

iPod
var isiPod = navigator.userAgent.match(/iPod/i)



參考網站:http://hsinyu00.wordpress.com/2011/04/05/mobile-web-user-agent-sniffing/

2011年8月6日 星期六

讓你的網頁擁有像Blog的文章編輯器

CKEditor 

這個網站提供很方便編輯器,他所提供的功能不僅有一般文字修改(粗體、斜體)

還包含超連結、圖片、縮行、以及表格等等的

功能十分強大,即使你的網站色系是暗色他也能做調整,是個還不錯的套件


Dome:http://ckeditor.com/demo
Downloads :http://ckeditor.com/download

2011年6月2日 星期四

[JavaScript] 開啟視窗

HTML
<a href="#" onclick="window.open('test.html','textfile',config='height=500,width=750,menubar=1')">
   詳細資料
</a>

可以直接開啟新視窗,並且再最可以隱藏工具列等其他的設定

下面是jQuery 寫法

HTML
<a href="#" id="userdata" >詳細資料</a>

jQuery
$("#userdata").click(function () { 
    window.open('/','textfile',config='height=500,width=750,menubar=1');
});


以下是參數

height=100 窗口高度;

width=400 窗口寬度;

top=0 窗口距離瀏覽器上方的像素值;

left=0 窗口距離瀏覽器左側的像素值;

toolbar=no 是否顯示工具列,yes為顯示、no為不顯示;

menubar=no 是否顯示選單列,yes為顯示、no為不顯示;

scrollbars=no 是否顯示滑動軸,yes為顯示、no為不顯示;

resizable=no 是否允許改變窗口大小,yes為允許、no為不允許;

location=no 是否允許顯示網址列,yes為允許、no為不允許;

status=no 是否顯示狀態檔內的訊息,yes為允許、no為不允許;



參考網站:http://www.study-area.org/coobila/tutorial_275.html
                http://www.javascript-coder.com/window-popup/javascript-window-open.phtml
                http://kyo0183.blogspot.com/2008/10/windowopen.html