close


介紹幾個部落格常會用到的語法,
只要複製以下語法貼到CSS或版面設定裡即可。

貼語法教學:

教學 | 語法放置方法
教學 | 物件放置方法

----------------------------------
更換滑鼠游標

<style type='text/css'>
<!--
body{cursor:url(游標網址);}
a{cursor:url(游標網址);}
-->
</style>


「body」裡的游標指的是正常狀態下所顯示的游標
「a」裡的游標指的是當指向連結時所顯示的游標


----------------------------------
現在日期

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var now = new Date();
var month = now.getMonth() + 1;
var date = now.getDate();
var year = now.getYear();
var season;
if (month > 1 && month <= 3) season = "冬季 ";
if (month == 3 && date > 19) season = "春季 ";
if (month > 3 && month <= 6) season = "春季 ";
if (month == 6 && date > 20) season = "夏季 ";
if (month > 6 && month <= 9) season = "夏季 ";
if (month == 9 && date > 21) season = "秋季 ";
if (month > 9 && month <= 12) season = "秋季 ";
if (month == 12 && date > 20) season = "冬季 ";
//Y2K Fix
if (year < 2000) year = year + 1900;
//Winter Season Fix
if (season == "Winter") year = year - 1;
document.write(year + " 年 " + season + month + " 月 " + date + " 日 ");
// End -->
</script>


----------------------------------
倒數計時

<script language="javascript">
<!--

var set_y = 2008;//指定日期的年份
var set_m = 1;//指定日期的月份
var set_d = 1;//指定的日期

var now = new Date();
var spday= new Date(set_y,set_m-1,set_d);
a = (spday.getTime() - now.getTime())/(24*60*60*1000);
a= Math.ceil(a);

if(a >0) document.write("距離2008年只剩下",a,"天");//日期還未經過的文字
else if(a==0) document.write("HAPPY NEW YEAR");//指定日期當天所出現的文字
else if(a <0) document.write("2008年已經過了",-a,"天");//指定日期已經過了的文字

//--></script>


----------------------------------
天數計算

平凡人成立至今已過
<script language="JavaScript">
<!--
var now=new Date();var spday=new Date(2007,8-1,17);
a=(now.getTime()-spday.getTime())/(24*60*60*1000);a=Math.ceil(a);
document.write("<b>"+a+"</b>");
--></script>天


更改日期的方法:

例2007年6月25日,便將Date(2007,8-1,17)改為Date(2007,6-1,25)
  Date(2007,8-1,17) 此-1不能刪除!


----------------------------------
下拉式選單

<script language="JavaScript">
<!-- Hide the script from old browsers --
function surfto(form) {
var myindex=form.javamagic.selectedIndex
window.open(form.javamagic.options[myindex].value,"_blank","");  //指定連結頁框名稱
}
//-->
</SCRIPT>
<br><form name="myform">
<SELECT NAME="javamagic" SIZE=1>
<OPTION SELECTED VALUE="">連 結 選 項
<OPTION VALUE="http://hugo730.netfirms.com">魚蛋村
<OPTION VALUE="http://hk.yahoo.com">香港雅虎
</SELECT>
<input type="button" value="Go" onClick="surfto(this.form)">
</form>


----------------------------------
logo連結

<a href="連結網址" _fcksavedurl=""連結網址"" target="_blank"><img src="logo網址" _fcksavedurl=""logo網址"" border="0" alt="網頁名稱"></a>


----------------------------------




語法來源:魚蛋村








arrow
arrow
    全站熱搜

    melodysong 發表在 痞客邦 留言(0) 人氣()