Archive for the 'Html,Js,Ajax相關' Category

jStorage

出處http://www.jstorage.info/

這2天在找一下可以儲存在Local端的web 應用!
當然HTML5 已提供的web sql看起來是很好!但FF似乎還不打算支援..(個人見解)

所以找了一下解決方案,其實還不難找!

我現在使用了jstorage來解決我的需要!

用法也相對的簡單!

有需要的可以參考一下囉!

$.jStorage.set("cart[1]","test obj");//設定資料
$.jStorage.get("expire_dt[1]", "default value")//取得資料,如果為空值,則使用預設值

Popularity: 3% [?]

Share

[備忘]在PHP中強制傳送big5編碼給jquery xhr解讀

今天幫一支舊程式改成使用jquery的方式去request 一個網頁,因為網站是之前寫的還沿用big5編碼!

使得Jquery在傳送資料時解讀成亂碼!
Continue reading ‘[備忘]在PHP中強制傳送big5編碼給jquery xhr解讀’

Popularity: 15% [?]

Share

[備忘]解決IE6不支援 PNG 背景透明的問題!

雖然IE6 已日漸被網民們淘汰!但還是會有部份的網民使用IE6瀏覽!
在新的IE版本中,皆已支援了PNG背景透明的功能!

在IE6則是要想辦法解決!

可以使用 IE PNG Fix2 來達成!

修正檔下載網址

Continue reading ‘[備忘]解決IE6不支援 PNG 背景透明的問題!’

Popularity: 9% [?]

Share

Jquery Validator 的addMethod用法備忘~~~~

之前遍查不到validator的addMethod用法 官方的文件也不是說的很明白 由於我需要用正規化來做一些原本validator沒有的驗証規則
Continue reading ‘Jquery Validator 的addMethod用法備忘~~~~’

Popularity: 36% [?]

Share

大頭恩之prototype.js學習手記(04)

連發3篇..進度應該有趕上吧!

這篇介紹的是$A()
A..作者應該是用來表示陣列的意思吧
所以它可以用來取像select box這樣有多個值的物件
請看範例說明
Continue reading ‘大頭恩之prototype.js學習手記(04)’

Popularity: 41% [?]

Share

大頭恩Prototype.js學習手記(03)

第3篇手記要介紹的是$F()

對了..在用這些功能時,請記住…大小寫是有區分的哦!
Continue reading ‘大頭恩Prototype.js學習手記(03)’

Popularity: 34% [?]

Share

大頭恩之Prototype.js 學習手記(02)

最近心情一直都不好…晚上都失眠…偷懶了好幾天…才再補上第2篇筆記….><
好了..第二個功能是$$()
Continue reading ‘大頭恩之Prototype.js 學習手記(02)’

Popularity: 33% [?]

Share

加裝wp-syntax,使用方式如下

Example 1: PHP, no line numbers

在原始碼模式下,使用下列語法
<div id="foo">
< ?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>
<div id="foo">
< ?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>

Continue reading ‘加裝wp-syntax,使用方式如下’

Popularity: 21% [?]

Share

使用setTimeout() 加 innerHtml屬性制作時鐘

<script language="JavaScript">
<!–
var now,hours,minutes,seconds,timeValue;
function showtime(){
now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
timeValue = (hours >= 12) ? "下午 " : "上午 ";
timeValue += ((hours > 12) ? hours – 12 : hours) + " 點";
timeValue += ((minutes < 10) ? " 0″ : " ") + minutes + " 分";
timeValue += ((seconds < 10) ? " 0″ : " ") + seconds + " 秒";
clock.innerHTML = timeValue;
setTimeout("showtime()",1000);
}
showtime();
//–>
</script>
<body onload="showtime();" >
<span id=’clock’></span>

  • <span id=’clock’></span>用來顯示時間的文字圖層。
  • var now, hours, minutes, seconds, timeValue,宣告變數
  • now=new Date()
    hours=now.getHours();,取得現在的時間,依次類推
  • clock.innerHTML=timeValue;利用InnerHtml屬性設定clock span tag中的內容
  • setTimeout("showtime()",1000),setTimeout就是計時器,每隔1000毫秒會重新執行一次showtime();
  • Popularity: 18% [?]

    Share

    FireFox,IE相容的無縫跑馬燈

    <STYLE type=text/css>
    #demo a {
    width:100%;
    overflow:hidden;
    font:12px/16px tahoma;
    display:block;
    text-decoration:none;
    margin:2px;
    color:#4a551c;
    padding-left:2px;
    text-align:left;
    }
    #demo a:hover {
    color:#ff6600;
    }

    </STYLE>
    </HEAD>
    <body>
    <div id="demo" style="overflow:hidden;height:100px;width:400px;  overflow:hidden;">
    <div id=demo1>
    <a href="#" mce_href="#">完全相容IE, FF, Opera跑馬燈語法1</a>
    <a href="#" mce_href="#">完全相容IE, FF, Opera跑馬燈語法2</a>
    <a href="#" mce_href="#">完全相容IE, FF, Opera跑馬燈語法3</a>
    </div>
    <div id=demo2></div>
    </div>
    <script>
    var speed=40
    var demo=document.getElementById("demo");
    var demo2=document.getElementById("demo2″);
    var demo1=document.getElementById("demo1″);
    demo2.innerHTML=demo1.innerHTML
    demo2.innerHTML=demo2.innerHTML+demo1.innerHTML
    function Marquee(){
    if(demo2.offsetTop-demo.scrollTop<=0)
    demo.scrollTop-=demo1.offsetHeight
    else{
    demo.scrollTop++
    }
    }
    var MyMar=setInterval(Marquee,speed)
    demo.onmouseover=function() {clearInterval(MyMar)}
    demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)
    }
    </script>
    </body>

    找了很久..終於有個FF及IE都支援的例子了…使用上沒什麼需要注意的!
    唯一就是Div 中的超連結數量要多一點..要不然..如果div的height不夠高..那跑馬燈會不能動…那如果超連結不夠多..,可以加上下面的語法

    demo2.innerHTML=demo2.innerHTML+demo1.innerHTML

    這樣就可以用了

    Popularity: 25% [?]

    Share



    Switch to our mobile site