顯示具有 Browser and System 標籤的文章。 顯示所有文章
顯示具有 Browser and System 標籤的文章。 顯示所有文章

2008年3月14日 星期五

設為首頁的程式碼

支援的瀏覽器:IE 5 +

簡介:按下連結便可設定網頁為首頁

<a href="#"
onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://lamkc.blogspot.com');">Click
here to make Dynamic Drive your default homepage</a>

2008年3月13日 星期四

加到我的最愛

支援的瀏覽器:Firefox 1.x+, IE4+ and Opera7+
簡介:按下連結可將網頁加到我的最愛

步驟1:
放置下列Code到</head>
<script
type="text/javascript">

/*
Modified to support Opera */
function
bookmarksite(title,url){
if (window.sidebar) //
firefox
window.sidebar.addPanel(title, url,
"");
else if(window.opera &&
window.print){ // opera
var elem =
document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}

else if(document.all)// ie
window.external.AddFavorite(url,
title);
}
</script>


步驟2:
javascript:bookmarksite('title_of_site', 'url_of_site')

新增a連結標籤,加到href後
例子:<a href="javascript:bookmarksite('Lam KC', 'http://lamkc.blogspot.com')">加此頁到我的最愛</a>

注意事項:若你的網頁的title包括 ',請加上 /
例子:<a href="javascript:bookmarksite('It\'s My Site', 'http://lamkc.blogspot.com')">加此頁到我的最愛</a>

顯示瀏覽者的瀏覽螢幕解析度

瀏覽螢幕解析度
支援的瀏覽器:FF1+ IE5+ Opr7+
簡介:顯示瀏覽者的瀏覽螢幕解析度


<script language="JavaScript1.2">

<!--



var correctwidth=800

var correctheight=600

if (screen.width!=correctwidthscreen.height!=correctheight)

document.write("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+".
Your current resolution is "+screen.width+"*"+screen.height+". If possible,
please change the resolution!")

//-->

</script>



修改"correctwidth" 及 "correctheight"