2007年10月2日 星期二

Apache 檔案上傳限制設定

要修改的地方有二個
1.Apache的httpd.conf
2.PHP的phi.ini

httpd.conf的部份

< f i l e s >
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288
註:524288是512*1024,單位為bit
< / f i l e s >


php.ini的部份

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 20000

;Maximum execution time of each script, in seconds
max_input_time = 20000

; Maximum amount of time each script may spend parsing request data
memory_limit = 50M

; Maximum amount of memory a script may consume (50MB,default =8MB)

post_max_size = 50M

; Maximum size of POST data that PHP will accept.

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 100M

要修改的地方有二個
1.Apache的httpd.conf
2.PHP的phi.ini

httpd.conf的部份

< f i l e s >
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288
註:524288是512*1024,單位為bit
< / f i l e s >


php.ini的部份

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 20000

;Maximum execution time of each script, in seconds
max_input_time = 20000

; Maximum amount of time each script may spend parsing request data
memory_limit = 50M

; Maximum amount of memory a script may consume (50MB,default =8MB)

post_max_size = 50M

; Maximum size of POST data that PHP will accept.

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 100M

2007年10月1日 星期一

投資基金 善用夏普值、標準差

投資基金二年多了...
一直以來都是大概看一下市場趨勢...
下手....績效到一定程度就贖回...
從來就不看夏普值、標準差的....

看了這篇文章..來我要好好利用這二個數值了.....


投資基金 善用夏普值、標準差

面對投資,復華投信亞太成長基金經理人楊惠元要投資人捐棄一切先入為主的觀念,善用夏普值(Sharp Ra-tio)與標準差(Standard Devia-tion)這兩個容易獲得的統計數據,選出良好基金,並且決定進出場時點。


「許多投資人會被發行投信、產品的話題誤導」,楊惠元表示,不少投資人迷信「外國的月亮比較圓」,堅信海外市場就該由外資投信操盤,或是過度熱衷於話題基金。回歸到投資本質,一個好的全球基金操作團隊,什麼樣的話題熱潮都會即時布局,端賴投資人有沒有辦法找出這樣的基金。

37歲的楊惠元,在投資上相當積極,投資基金以單筆操作為主,因此挑選基金、決定進出場時點變的非常重要。在挑選基金上,楊惠元建議投資人可以回歸數字面,理性選擇基金。 首先,楊惠元要投資人參考基金的夏普值,夏普值是指基金每一單位的風險所能獲得的超額報酬,該值愈高,表示在相同風險下,帶來的報酬愈大,也就是基金的績效愈好,是同時衡量風險及報酬的最佳指標。

楊惠元認為,夏普值是最能夠彰顯操盤能力的數值,因此建議投資人以夏普值篩選基金。 在選出基金後,建議可以由報酬率的標準差來衡量基金的波動度,以決定進出場時機。簡單而言,在基金報酬率幅度高出一個標準差時,就可以贖回一半的投資金額,高出兩個標準差時,便可以全面獲利了結。

若是基金在市場態勢不變下,績效卻不如預期,報酬率幅度低於平均超過一個標準差,這時候代表基金處於低點,建議可以加碼一半額度,或是降低超過兩個標準差,則建議全面加碼,低點布局。

那麼,什麼時候應該認賠出場呢?投資態度積極的楊惠元表示,假設市場出現反轉趨勢,或基金報酬率持續低於平均超過一個標準差的情況逾一個禮拜,就建議認賠出場。 一個禮拜的時間或許很短,但在楊惠元觀念中,資金利用分秒必爭,表現偏弱的市場,長線雖然有回升可能,但在資金等待市場轉強的同時,一定有更好的標的可以投資。然而,楊惠元提醒投資人,這樣的基金操作方式需要有一定的歷史依據,建議投資人介入成立二、三年以上的基金,並且搭配總體經濟、產業新聞觀察,投資方向將更明確。


徐慧君 【2007-09-24/經濟日報/B5版/基金平台】
投資基金二年多了...
一直以來都是大概看一下市場趨勢...
下手....績效到一定程度就贖回...
從來就不看夏普值、標準差的....

看了這篇文章..來我要好好利用這二個數值了.....


投資基金 善用夏普值、標準差

面對投資,復華投信亞太成長基金經理人楊惠元要投資人捐棄一切先入為主的觀念,善用夏普值(Sharp Ra-tio)與標準差(Standard Devia-tion)這兩個容易獲得的統計數據,選出良好基金,並且決定進出場時點。


「許多投資人會被發行投信、產品的話題誤導」,楊惠元表示,不少投資人迷信「外國的月亮比較圓」,堅信海外市場就該由外資投信操盤,或是過度熱衷於話題基金。回歸到投資本質,一個好的全球基金操作團隊,什麼樣的話題熱潮都會即時布局,端賴投資人有沒有辦法找出這樣的基金。

37歲的楊惠元,在投資上相當積極,投資基金以單筆操作為主,因此挑選基金、決定進出場時點變的非常重要。在挑選基金上,楊惠元建議投資人可以回歸數字面,理性選擇基金。 首先,楊惠元要投資人參考基金的夏普值,夏普值是指基金每一單位的風險所能獲得的超額報酬,該值愈高,表示在相同風險下,帶來的報酬愈大,也就是基金的績效愈好,是同時衡量風險及報酬的最佳指標。

楊惠元認為,夏普值是最能夠彰顯操盤能力的數值,因此建議投資人以夏普值篩選基金。 在選出基金後,建議可以由報酬率的標準差來衡量基金的波動度,以決定進出場時機。簡單而言,在基金報酬率幅度高出一個標準差時,就可以贖回一半的投資金額,高出兩個標準差時,便可以全面獲利了結。

若是基金在市場態勢不變下,績效卻不如預期,報酬率幅度低於平均超過一個標準差,這時候代表基金處於低點,建議可以加碼一半額度,或是降低超過兩個標準差,則建議全面加碼,低點布局。

那麼,什麼時候應該認賠出場呢?投資態度積極的楊惠元表示,假設市場出現反轉趨勢,或基金報酬率持續低於平均超過一個標準差的情況逾一個禮拜,就建議認賠出場。 一個禮拜的時間或許很短,但在楊惠元觀念中,資金利用分秒必爭,表現偏弱的市場,長線雖然有回升可能,但在資金等待市場轉強的同時,一定有更好的標的可以投資。然而,楊惠元提醒投資人,這樣的基金操作方式需要有一定的歷史依據,建議投資人介入成立二、三年以上的基金,並且搭配總體經濟、產業新聞觀察,投資方向將更明確。


徐慧君 【2007-09-24/經濟日報/B5版/基金平台】

2007年9月17日 星期一

PHP 檢查信用卡號碼

以前寫過身份證字號的驗證程式...
自從有信用卡後...就常在想怎麼驗證信用卡號..
今天總算看到了...特別摘錄一下
參考資料來源:PHP 檢查信用卡號碼



PHP:
/* luhn_checker(): This is a small PHP function for checking valid *
* credit card with LUHN algorithm *
* *
* Last updated: 26 August 2007 *
* This is a free PHP script under GNU GPL version 2.0 or above *
* Copyright (C) 2007 Sam Tang *
* Feedback/comment/suggestions : http://www.real-blog.com/ */

function luhn_checker($card_num){
// 將非數字的字串移除
$card_num = preg_replace("/\D|\s/", "", $card_num);

$sum = 0;
for($i=0; $i $digit = substr($card_num, $i, 1);
if(($i % 2) == 0){
// 在單數位置的數值乘 2
$digit = $digit * 2;
}

if ($digit> 9) $digit = $digit - 9;
$sum += $digit;
}

if(($sum % 10) == 0 && strlen($card_num) == 16){
return TRUE;
}else{
return FALSE;
}
}

/* Example
if(luhn_checker("1234567812345678")){
echo "Correct!";
}else{
echo "Wrong card number!";
}
*/
?>

以前寫過身份證字號的驗證程式...
自從有信用卡後...就常在想怎麼驗證信用卡號..
今天總算看到了...特別摘錄一下
參考資料來源:PHP 檢查信用卡號碼



PHP:
/* luhn_checker(): This is a small PHP function for checking valid *
* credit card with LUHN algorithm *
* *
* Last updated: 26 August 2007 *
* This is a free PHP script under GNU GPL version 2.0 or above *
* Copyright (C) 2007 Sam Tang *
* Feedback/comment/suggestions : http://www.real-blog.com/ */

function luhn_checker($card_num){
// 將非數字的字串移除
$card_num = preg_replace("/\D|\s/", "", $card_num);

$sum = 0;
for($i=0; $i $digit = substr($card_num, $i, 1);
if(($i % 2) == 0){
// 在單數位置的數值乘 2
$digit = $digit * 2;
}

if ($digit> 9) $digit = $digit - 9;
$sum += $digit;
}

if(($sum % 10) == 0 && strlen($card_num) == 16){
return TRUE;
}else{
return FALSE;
}
}

/* Example
if(luhn_checker("1234567812345678")){
echo "Correct!";
}else{
echo "Wrong card number!";
}
*/
?>

2007年9月4日 星期二

PHP function: 亂數密碼產生

最近發現我很常在Tsung's Blog那邊挖寶

今天又看到PHP function: 亂數密碼產生這篇~

僅節錄程式部份及其說明

程式有兩個地方可以設定:
  $password_len: 設定密碼長度要多長
  $word: 設定密碼要包含那些字元(密碼會由這些字元去湊, 並產生出來)
  PS:照理說要符合上述所說的安全性, 最好是把符號, 英數字大小寫, 都另外存

    Array 來拼湊(確定一定產生出大小寫和符號), 這個以後再說吧. :P
程式執行方法:
  直接呼叫 generatorPassword(), 接收回傳值就是了.
  ex: $passwd = generatorPassword()

程式碼
<?php
function generatorPassword()
{
$password_len = 7;
$password = '';

// remove o,0,1,l
$word = 'abcdefghijkmnpqrstuvwxyz!@#$%^&*()-=ABCDEFGHIJKLMNPQRSTUVWXYZ<>;{}[]23456789';
$len = strlen($word);

for (
$i = 0; $i < $password_len; $i++) {
$password .= $word[rand() % $len];
}

return
$password;
}

// USAGE:
// echo generatorPassword() . "\n";
?>

最近發現我很常在Tsung's Blog那邊挖寶

今天又看到PHP function: 亂數密碼產生這篇~

僅節錄程式部份及其說明

程式有兩個地方可以設定:
  $password_len: 設定密碼長度要多長
  $word: 設定密碼要包含那些字元(密碼會由這些字元去湊, 並產生出來)
  PS:照理說要符合上述所說的安全性, 最好是把符號, 英數字大小寫, 都另外存

    Array 來拼湊(確定一定產生出大小寫和符號), 這個以後再說吧. :P
程式執行方法:
  直接呼叫 generatorPassword(), 接收回傳值就是了.
  ex: $passwd = generatorPassword()

程式碼
<?php
function generatorPassword()
{
$password_len = 7;
$password = '';

// remove o,0,1,l
$word = 'abcdefghijkmnpqrstuvwxyz!@#$%^&*()-=ABCDEFGHIJKLMNPQRSTUVWXYZ<>;{}[]23456789';
$len = strlen($word);

for (
$i = 0; $i < $password_len; $i++) {
$password .= $word[rand() % $len];
}

return
$password;
}

// USAGE:
// echo generatorPassword() . "\n";
?>

Aglogo網路賺錢回顧

太久沒回來關心這個了,於是又四處看看,看到robin的活動~
【活動】我幫你拉AGLOCO下線!

趕緊來參加~讓下線多增加幾個也好~~

Typed ROBIN 這個專講網路賺錢的部落格現在在舉辦一個【活動】我幫你拉AGLOCO下線! ,你不必是他的下線也可以參加,趕快去看看。

話說回來,Typed ROBIN 的網站還真不是蓋的,一直以來都有在認真關心Agloco的發展
而不是像其他網站(還有我的~)只是把文章貼一貼就算了~

從2月到現在,我大概也只有看到robin的站有在針對Agloco的發展持續發文,其他的倒是沒看到 (還是我資訊太落後,沒看到更屌的??)

可以從他每個月的AGLOCO月報 (2007/07)答覆網友對我幫你拉AGLOCO下線活動的疑慮
這一的文章中看出,他真的很用心在經營這件事!!

補充:真的是我太過無知了...剛剛用google搜尋了一下..
一瞬間又看到幾個好站...
網路賺錢三十六計-Adsense,AGLOCO,AdBux
Adsense繁體中文觀測站

看來我真的要多花點心思了.... 太久沒回來關心這個了,於是又四處看看,看到robin的活動~
【活動】我幫你拉AGLOCO下線!

趕緊來參加~讓下線多增加幾個也好~~

Typed ROBIN 這個專講網路賺錢的部落格現在在舉辦一個【活動】我幫你拉AGLOCO下線! ,你不必是他的下線也可以參加,趕快去看看。

話說回來,Typed ROBIN 的網站還真不是蓋的,一直以來都有在認真關心Agloco的發展
而不是像其他網站(還有我的~)只是把文章貼一貼就算了~

從2月到現在,我大概也只有看到robin的站有在針對Agloco的發展持續發文,其他的倒是沒看到 (還是我資訊太落後,沒看到更屌的??)

可以從他每個月的AGLOCO月報 (2007/07)答覆網友對我幫你拉AGLOCO下線活動的疑慮
這一的文章中看出,他真的很用心在經營這件事!!

補充:真的是我太過無知了...剛剛用google搜尋了一下..
一瞬間又看到幾個好站...
網路賺錢三十六計-Adsense,AGLOCO,AdBux
Adsense繁體中文觀測站

看來我真的要多花點心思了....

2007年9月3日 星期一

unix-like底下 apache2+php5+mysql5安裝方式

節錄自[分享] unix-like底下 apache2+php5+mysql5安裝方式
感謝acman's 便利地毯的分享

紅字部份為輸入之指令
切換目錄至/usr/local/src ;準備自行編譯
cd /usr/local/src

到以下的官方網站下載需要的版本
MySQL官方網站:http://www.mysql.com
Apache官方網站:http://www.apache.org
PHP官方網站:http://www.php.net

安裝mysqld:mysql-5.0.37
解開tarball
tar -zxvf mysql-5.0.37.tar.gz
切換到解開的目錄下
cd mysql-5.0.37
1.組態:(編譯參數參考原廠doc或是google找其它人的經驗或是依之前經驗)
./configure --prefix=/usr/local/mysql --localstatedir=/home/mysql --with-mysqld-user=mysql --enable-large-files
2.編譯
make
3.安裝
make install
4.複製系統設定檔至指定位置:
cp support-files/my-medium.cnf /etc/my.cnf
5.增加mysqld要使用的user跟group
vi /etc/group
新增一行內容為:mysql:x:60:
vi /etc/passwd
新增一行內容為:mysql:x:60:60:mysql:/home/mysql:/bin/false
6.切換資料夾
cd /usr/local/mysql
7.安裝系統資料庫
bin/mysql_install_db --user=mysql
8.更改目錄權限
chown -R root:mysql /home/mysql
9.啟動 MySql Server
bin/mysqld_safe --user=mysql &
10.更改資料庫管理者的管理密碼("new-password"部分請自行輸入):
bin/mysqladmin -u root password new-password

安裝apache:httpd-2.2.4
切換目錄
cd /usr/local/src
解開tarball
tar -zxvf httpd-2.2.4.tar.gz
切換到解開的目錄下
cd httpd-2.2.4
1.組態:
./configure --prefix=/home/apache --enable-shared=max --enable-module=most --enable-so
祝註:因為我偷懶的原因,所以apache的module是直接掛載,不在httpd.conf中一個一個自行選定是否載入
有空再做自行選擇的部份
2.編譯:
make
3.安裝:
make install

安裝php:php-5.2.1
安裝php前:為讓php support更多模組,以下部份先安裝(常用的)
指令:
gentoo適用:
emerge zlib
emerge libpng
emerge freetype
emerge jpeg
emerge gd
emerge libxml2

自行編譯者:自行找到tarball後(問google),直接組態->編譯->安裝,無需加任何參數
安裝php:php-5.2.1
切換目錄
cd /usr/local/src
解開tarball
tar -jxvf php-5.2.1.tar.bz2
切換到解開的目錄下
cd php-5.2.1

1.組態:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.2.4/bin/apxs --with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql --with-gd --with-jpeg --with-zlib --with-libxml --enable-socket --with-iconv --with-pear --enable-zend-multibyte
這部份同apache,php可以把許多功能都編成extensions,僅載入需要的部份,這也是我偏愛的方式.....不過在這邊也偷懶
2.編譯
make
3.安裝
make install
4. 檢查是否有生成apache需要的php module
ls -al /usr/local/apache2.2.4/modules/libphp5.so
5. 複制php的設定檔
cp /usr/local/src/php-5.2.1/php.ini-dist /usr/local/php/

設定apache的httpd.conf
1. 查看是否有增加這一行
LoadModule php5_module modules/libphp5.so
2.更改admin信箱:
ServerAdmin 你的emailaddress
3.設定伺服器名稱(可以使用dmian:www.ooo.net:80 或 192.168.1.1:80)
ServerName 192.168.1.1:80(用你自己機器的ip address啊)
4.找到DirectoryIndex敘述,設定首頁名稱加上 index.php
DirectoryIndex index.htm index.html index.php
5.找到AddType部份,增加一行:
AddType application/x-httpd-php .php
6.啟動apache
/usr/local/apache2.2.4/bin/apachectl start
7.檢查php是否有正常運作
在/usr/local/apache2.2.4/htdocs/底下新增一個檔案:info.php,內容如下:
<?
phpinfo();
?>

8.用瀏覽器看 http://你的ip/info.php
有phpinfo畫面生成的話就ok啦 節錄自[分享] unix-like底下 apache2+php5+mysql5安裝方式
感謝acman's 便利地毯的分享

紅字部份為輸入之指令
切換目錄至/usr/local/src ;準備自行編譯
cd /usr/local/src

到以下的官方網站下載需要的版本
MySQL官方網站:http://www.mysql.com
Apache官方網站:http://www.apache.org
PHP官方網站:http://www.php.net

安裝mysqld:mysql-5.0.37
解開tarball
tar -zxvf mysql-5.0.37.tar.gz
切換到解開的目錄下
cd mysql-5.0.37
1.組態:(編譯參數參考原廠doc或是google找其它人的經驗或是依之前經驗)
./configure --prefix=/usr/local/mysql --localstatedir=/home/mysql --with-mysqld-user=mysql --enable-large-files
2.編譯
make
3.安裝
make install
4.複製系統設定檔至指定位置:
cp support-files/my-medium.cnf /etc/my.cnf
5.增加mysqld要使用的user跟group
vi /etc/group
新增一行內容為:mysql:x:60:
vi /etc/passwd
新增一行內容為:mysql:x:60:60:mysql:/home/mysql:/bin/false
6.切換資料夾
cd /usr/local/mysql
7.安裝系統資料庫
bin/mysql_install_db --user=mysql
8.更改目錄權限
chown -R root:mysql /home/mysql
9.啟動 MySql Server
bin/mysqld_safe --user=mysql &
10.更改資料庫管理者的管理密碼("new-password"部分請自行輸入):
bin/mysqladmin -u root password new-password

安裝apache:httpd-2.2.4
切換目錄
cd /usr/local/src
解開tarball
tar -zxvf httpd-2.2.4.tar.gz
切換到解開的目錄下
cd httpd-2.2.4
1.組態:
./configure --prefix=/home/apache --enable-shared=max --enable-module=most --enable-so
祝註:因為我偷懶的原因,所以apache的module是直接掛載,不在httpd.conf中一個一個自行選定是否載入
有空再做自行選擇的部份
2.編譯:
make
3.安裝:
make install

安裝php:php-5.2.1
安裝php前:為讓php support更多模組,以下部份先安裝(常用的)
指令:
gentoo適用:
emerge zlib
emerge libpng
emerge freetype
emerge jpeg
emerge gd
emerge libxml2

自行編譯者:自行找到tarball後(問google),直接組態->編譯->安裝,無需加任何參數
安裝php:php-5.2.1
切換目錄
cd /usr/local/src
解開tarball
tar -jxvf php-5.2.1.tar.bz2
切換到解開的目錄下
cd php-5.2.1

1.組態:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.2.4/bin/apxs --with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql --with-gd --with-jpeg --with-zlib --with-libxml --enable-socket --with-iconv --with-pear --enable-zend-multibyte
這部份同apache,php可以把許多功能都編成extensions,僅載入需要的部份,這也是我偏愛的方式.....不過在這邊也偷懶
2.編譯
make
3.安裝
make install
4. 檢查是否有生成apache需要的php module
ls -al /usr/local/apache2.2.4/modules/libphp5.so
5. 複制php的設定檔
cp /usr/local/src/php-5.2.1/php.ini-dist /usr/local/php/

設定apache的httpd.conf
1. 查看是否有增加這一行
LoadModule php5_module modules/libphp5.so
2.更改admin信箱:
ServerAdmin 你的emailaddress
3.設定伺服器名稱(可以使用dmian:www.ooo.net:80 或 192.168.1.1:80)
ServerName 192.168.1.1:80(用你自己機器的ip address啊)
4.找到DirectoryIndex敘述,設定首頁名稱加上 index.php
DirectoryIndex index.htm index.html index.php
5.找到AddType部份,增加一行:
AddType application/x-httpd-php .php
6.啟動apache
/usr/local/apache2.2.4/bin/apachectl start
7.檢查php是否有正常運作
在/usr/local/apache2.2.4/htdocs/底下新增一個檔案:info.php,內容如下:
<?
phpinfo();
?>

8.用瀏覽器看 http://你的ip/info.php
有phpinfo畫面生成的話就ok啦

2007年8月23日 星期四

無間斷圖片跑馬燈

男丁格爾's 脫殼玩
那看到了一種做法無間斷圖片跑馬燈
看似不錯,但畫面會被拉長...

因綠際會下...不小心在網路上找到了下面這方法
唯因為原作者己不可考...故無法列出處(若原作者有看到,請來信通知,好讓我補上,謝謝)


原始程式如下....原作者的註解我就不做更動
中文部份是我自己加上的註解

//這是要滾動的內容,最好用div包起來
<div id="scrollbarDemo">
這裡是要滾動的內容
</div>

<SCRIPT type="text/javascript">
//這一塊是主要程式運作的地方
var __scrollBarControl = null;
var __divinnerHTML=null;
var __firstTime=true;
function innerBarProp(barID, width, height, interval, direction)
{
 this.barID = barID;
 this.width = width;
 this.height = height;
 this.interval = interval;
 this.direction = direction;
 this.stopScroll = false;
 this.maxValue = 0;
 this.preValue = 0;
}
function scrollBar()
{
 this.barsArray = new Array();
 //save current object
 __scrollBarControl = this;
}
//////////////////////////////////////////////////////////////////
// add scrollbar to bar list and set properties
// parameters:
// barID: HTML's tag <DIV>'s id property
// (for js access the DIV object)
// width: define the scrollbar's width
// height: define the scrollbar's height
// interval: define the scroll speed
// ( scroll up/down per XX millinSecond )
// direction: scroll direction's defined
// "up"
// "down"
// "left"
// "right"
//////////////////////////////////////////////////////////////////
scrollBar.prototype.addBar = function(barID, width, height, interval, direction)
{
 //check parameters
 var paraCount = arguments.length;
 if ( paraCount < 1 )
 {
  alert("parameters count incorect!");
  return;
  //throw "parameters count inccorect!";
 }

 //width's default value
 if ( typeof( width ) == "undefined" )
 {
  var width = 100;
 }

 //height's default value
 if ( typeof( height ) == "undefined" )
 {
  var height = 100;
 }

 //interval's default value
 if ( typeof( interval ) == "undefined" )
 {
  var interval = 1000;
 }
 
 //direction's default value
 if ( typeof( direction ) == "undefined" )
 {
  var direction = "up";
 }

 //create scrollbar's inner properties
 var barProp = new innerBarProp(barID, width, height, interval, direction);
 var objBar = document.getElementById(barID);
 if(__divinnerHTML!=null)
  objBar.innerHTML=__divinnerHTML;
 else
  __divinnerHTML=objBar.innerHTML;
 var barCount = this.barsArray.length;
 this.barsArray[barCount] = barProp;
}
scrollBar.prototype.clear = function()
{
 for(i=0;i<this.barsArray.length;i++)
  this.barsArray.pop();
}
scrollBar.prototype.createScrollBars = function()
{
 //get bar's count
 var barCount = this.barsArray.length;
 //if no bar add to scrollControl do nothing
 if ( barCount == 0 )
 {
  return;
 }

 //init scroll bars
 for ( var i=0; i<barCount; i++ )
 {
  var objBarID = this.barsArray[i].barID;
  //if typeof objBarID is object
  // that's meaning it inited
  //if typeof objBarID is string
  // init that scroll bar
  if ( typeof( objBarID ) == "string" )
  {
   //get scroll <DIV> object
   var objBar = document.getElementById( objBarID );
   if (objBar == null)
   {
    //objBarID is not exist
    if ( document.readyState == "complete" || document.readyState == "loaded" )
    {
     //the objBarID not exists in current document
     //throw "the objBarID is not exists.";
     alert("ScrollBar[" + objBarID + "]: not exist!");
     return;
    }
    else
    {
     //wait for document to load objBarID
     window.setTimeout("__scrollBarControl.createScrollBars()",50);
     //exit processing..........
     //and wait next time callbak
     return;
    }
   }
   //update barID
   this.barsArray[i].barID = objBar;
  }
 }

 for ( var i=0; i<barCount; i++ )
 {
  this.innerInitBar(i);
 }
}
scrollBar.prototype.innerInitBar = function (index)
{
 //get properties
 var barID = this.barsArray[index].barID;
 var width = this.barsArray[index].width;
 var height = this.barsArray[index].height;
 var interval = this.barsArray[index].interval;
 var direction = this.barsArray[index].direction;
 var maxValue = 0;

 //set scrollBar's properties
 with(barID)
 {
  style.width = width;
  style.height = height;
  noWrap=true;
  switch( direction )
  {
   //這裡是實際決定滾動方向及內容的地方
   //有up,down,left,right
   case "up":
    maxValue = Math.max(scrollHeight, height);
    style.overflowX = "visible";
    style.overflowY = "hidden";
    //宣告barHtml來放代入的div裡面的內容
    var barHtml = innerHTML;
    //將之複製二次,並擺在一個table裡面
    //若外面傳入的div裡面的table己寫好
    //這裡則可以直接省略,直接使用innerHTML = barHtml+barHtml;來代替
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0'>\n";
    newHtml += " <tr height='20'>\n";
    newHtml += " <td> \n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    break;
   case "down":
    maxValue = Math.max(scrollHeight, height);
    style.overflowX = "visible";
    style.overflowY = "hidden";
    var barHtml = innerHTML;
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0'>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    scrollTop = maxValue;
    break;
   case "left":
    maxValue = Math.max(scrollWidth, width);
    style.overflowX = "hidden";
    style.overflowY = "visible";
    var barHtml = barID.innerHTML;
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0' width='" + (maxValue * 2 ) + "'>\n";
    newHtml += " <tr>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    break;
   case "right":
    maxValue = Math.max(scrollWidth, width);
    style.overflowX = "hidden";
    style.overflowY = "visible";
    var barHtml = innerHTML;
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0' width='" + (maxValue * 2 ) + "'>\n";
    newHtml += " <tr>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    scrollLeft = maxValue;
    break;
   default:
    //throw "direction is inccorect!";
    alert("ScrollBar[" + id + "]: direction is incorect!");
    return;
  }

  //set mouse events
  onmouseover = new Function("__scrollBarControl.mouseEvt(" + index + ",true);");
  onmouseout = new Function("__scrollBarControl.mouseEvt(" + index + ",false);");
  if(__firstTime)
  {
   __firstTime=false;
   window.setInterval("__scrollBarControl.scroll(" + index + ");",interval);
  }
  //save maxValue
  this.barsArray[index].maxValue = maxValue;
 }
}
scrollBar.prototype.mouseEvt = function(index, stop)
{
 this.barsArray[index].stopScroll = stop;
}
scrollBar.prototype.scroll = function(index)
{
 //get properties
 var barID = this.barsArray[index].barID;
 var width = this.barsArray[index].width;
 var height = this.barsArray[index].height;
 var interval = this.barsArray[index].interval;
 var direction = this.barsArray[index].direction;
 var stopScroll = this.barsArray[index].stopScroll;
 var preValue = this.barsArray[index].preValue;
 var maxValue = this.barsArray[index].maxValue;

 if ( stopScroll == true ) return;

 switch(direction)
 {
  case "up":
   preValue++;
   if ( preValue >= maxValue )
   {
    preValue = 0;
   }
   barID.scrollTop = preValue;
   break;
  case "down":
   preValue--;
   if ( preValue <= 0 )
   {
    preValue = maxValue;
   }
   barID.scrollTop = preValue;
   break;
  case "left":
   preValue++;
   if ( preValue >= maxValue )
   {
    preValue = 0;
   }
   barID.scrollLeft = preValue;
   break;
  case "right":
   preValue--;
   if ( preValue <=0 )
   {
    preValue = maxValue;
   }
   barID.scrollLeft = preValue;
   break;
 }
 this.barsArray[index].preValue = preValue;
}
//=================end of file===========================
</SCRIPT>
<SCRIPT type="text/javascript">
//這裡是使用在網頁上的
var scrollBarControl = new scrollBar();
MoveTo("up");
function MoveTo(d)
{
 //清除剛才宣告的scrollbarcontrol
 scrollBarControl.clear();
 //新增一欲滾動的ID,五個參數分別為
 //欲滾動的區塊ID,寬,高,速度,方向
 scrollBarControl.addBar("scrollbarDemo", 228, 120, 100, d);
 scrollBarControl.createScrollBars();
}
</SCRIPT>

男丁格爾's 脫殼玩
那看到了一種做法無間斷圖片跑馬燈
看似不錯,但畫面會被拉長...

因綠際會下...不小心在網路上找到了下面這方法
唯因為原作者己不可考...故無法列出處(若原作者有看到,請來信通知,好讓我補上,謝謝)


原始程式如下....原作者的註解我就不做更動
中文部份是我自己加上的註解

//這是要滾動的內容,最好用div包起來
<div id="scrollbarDemo">
這裡是要滾動的內容
</div>

<SCRIPT type="text/javascript">
//這一塊是主要程式運作的地方
var __scrollBarControl = null;
var __divinnerHTML=null;
var __firstTime=true;
function innerBarProp(barID, width, height, interval, direction)
{
 this.barID = barID;
 this.width = width;
 this.height = height;
 this.interval = interval;
 this.direction = direction;
 this.stopScroll = false;
 this.maxValue = 0;
 this.preValue = 0;
}
function scrollBar()
{
 this.barsArray = new Array();
 //save current object
 __scrollBarControl = this;
}
//////////////////////////////////////////////////////////////////
// add scrollbar to bar list and set properties
// parameters:
// barID: HTML's tag <DIV>'s id property
// (for js access the DIV object)
// width: define the scrollbar's width
// height: define the scrollbar's height
// interval: define the scroll speed
// ( scroll up/down per XX millinSecond )
// direction: scroll direction's defined
// "up"
// "down"
// "left"
// "right"
//////////////////////////////////////////////////////////////////
scrollBar.prototype.addBar = function(barID, width, height, interval, direction)
{
 //check parameters
 var paraCount = arguments.length;
 if ( paraCount < 1 )
 {
  alert("parameters count incorect!");
  return;
  //throw "parameters count inccorect!";
 }

 //width's default value
 if ( typeof( width ) == "undefined" )
 {
  var width = 100;
 }

 //height's default value
 if ( typeof( height ) == "undefined" )
 {
  var height = 100;
 }

 //interval's default value
 if ( typeof( interval ) == "undefined" )
 {
  var interval = 1000;
 }
 
 //direction's default value
 if ( typeof( direction ) == "undefined" )
 {
  var direction = "up";
 }

 //create scrollbar's inner properties
 var barProp = new innerBarProp(barID, width, height, interval, direction);
 var objBar = document.getElementById(barID);
 if(__divinnerHTML!=null)
  objBar.innerHTML=__divinnerHTML;
 else
  __divinnerHTML=objBar.innerHTML;
 var barCount = this.barsArray.length;
 this.barsArray[barCount] = barProp;
}
scrollBar.prototype.clear = function()
{
 for(i=0;i<this.barsArray.length;i++)
  this.barsArray.pop();
}
scrollBar.prototype.createScrollBars = function()
{
 //get bar's count
 var barCount = this.barsArray.length;
 //if no bar add to scrollControl do nothing
 if ( barCount == 0 )
 {
  return;
 }

 //init scroll bars
 for ( var i=0; i<barCount; i++ )
 {
  var objBarID = this.barsArray[i].barID;
  //if typeof objBarID is object
  // that's meaning it inited
  //if typeof objBarID is string
  // init that scroll bar
  if ( typeof( objBarID ) == "string" )
  {
   //get scroll <DIV> object
   var objBar = document.getElementById( objBarID );
   if (objBar == null)
   {
    //objBarID is not exist
    if ( document.readyState == "complete" || document.readyState == "loaded" )
    {
     //the objBarID not exists in current document
     //throw "the objBarID is not exists.";
     alert("ScrollBar[" + objBarID + "]: not exist!");
     return;
    }
    else
    {
     //wait for document to load objBarID
     window.setTimeout("__scrollBarControl.createScrollBars()",50);
     //exit processing..........
     //and wait next time callbak
     return;
    }
   }
   //update barID
   this.barsArray[i].barID = objBar;
  }
 }

 for ( var i=0; i<barCount; i++ )
 {
  this.innerInitBar(i);
 }
}
scrollBar.prototype.innerInitBar = function (index)
{
 //get properties
 var barID = this.barsArray[index].barID;
 var width = this.barsArray[index].width;
 var height = this.barsArray[index].height;
 var interval = this.barsArray[index].interval;
 var direction = this.barsArray[index].direction;
 var maxValue = 0;

 //set scrollBar's properties
 with(barID)
 {
  style.width = width;
  style.height = height;
  noWrap=true;
  switch( direction )
  {
   //這裡是實際決定滾動方向及內容的地方
   //有up,down,left,right
   case "up":
    maxValue = Math.max(scrollHeight, height);
    style.overflowX = "visible";
    style.overflowY = "hidden";
    //宣告barHtml來放代入的div裡面的內容
    var barHtml = innerHTML;
    //將之複製二次,並擺在一個table裡面
    //若外面傳入的div裡面的table己寫好
    //這裡則可以直接省略,直接使用innerHTML = barHtml+barHtml;來代替
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0'>\n";
    newHtml += " <tr height='20'>\n";
    newHtml += " <td> \n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    break;
   case "down":
    maxValue = Math.max(scrollHeight, height);
    style.overflowX = "visible";
    style.overflowY = "hidden";
    var barHtml = innerHTML;
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0'>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += " <tr>\n";
    newHtml += " <td height='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    scrollTop = maxValue;
    break;
   case "left":
    maxValue = Math.max(scrollWidth, width);
    style.overflowX = "hidden";
    style.overflowY = "visible";
    var barHtml = barID.innerHTML;
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0' width='" + (maxValue * 2 ) + "'>\n";
    newHtml += " <tr>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    break;
   case "right":
    maxValue = Math.max(scrollWidth, width);
    style.overflowX = "hidden";
    style.overflowY = "visible";
    var barHtml = innerHTML;
    var newHtml = "<table border='0' cellspacing='0' cellpadding='0' width='" + (maxValue * 2 ) + "'>\n";
    newHtml += " <tr>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " <td width='" + maxValue + "' valign='top'>\n";
    newHtml += barHtml + "\n";
    newHtml += " </td>\n";
    newHtml += " </tr>\n";
    newHtml += "</table>\n";
    innerHTML = newHtml;
    scrollLeft = maxValue;
    break;
   default:
    //throw "direction is inccorect!";
    alert("ScrollBar[" + id + "]: direction is incorect!");
    return;
  }

  //set mouse events
  onmouseover = new Function("__scrollBarControl.mouseEvt(" + index + ",true);");
  onmouseout = new Function("__scrollBarControl.mouseEvt(" + index + ",false);");
  if(__firstTime)
  {
   __firstTime=false;
   window.setInterval("__scrollBarControl.scroll(" + index + ");",interval);
  }
  //save maxValue
  this.barsArray[index].maxValue = maxValue;
 }
}
scrollBar.prototype.mouseEvt = function(index, stop)
{
 this.barsArray[index].stopScroll = stop;
}
scrollBar.prototype.scroll = function(index)
{
 //get properties
 var barID = this.barsArray[index].barID;
 var width = this.barsArray[index].width;
 var height = this.barsArray[index].height;
 var interval = this.barsArray[index].interval;
 var direction = this.barsArray[index].direction;
 var stopScroll = this.barsArray[index].stopScroll;
 var preValue = this.barsArray[index].preValue;
 var maxValue = this.barsArray[index].maxValue;

 if ( stopScroll == true ) return;

 switch(direction)
 {
  case "up":
   preValue++;
   if ( preValue >= maxValue )
   {
    preValue = 0;
   }
   barID.scrollTop = preValue;
   break;
  case "down":
   preValue--;
   if ( preValue <= 0 )
   {
    preValue = maxValue;
   }
   barID.scrollTop = preValue;
   break;
  case "left":
   preValue++;
   if ( preValue >= maxValue )
   {
    preValue = 0;
   }
   barID.scrollLeft = preValue;
   break;
  case "right":
   preValue--;
   if ( preValue <=0 )
   {
    preValue = maxValue;
   }
   barID.scrollLeft = preValue;
   break;
 }
 this.barsArray[index].preValue = preValue;
}
//=================end of file===========================
</SCRIPT>
<SCRIPT type="text/javascript">
//這裡是使用在網頁上的
var scrollBarControl = new scrollBar();
MoveTo("up");
function MoveTo(d)
{
 //清除剛才宣告的scrollbarcontrol
 scrollBarControl.clear();
 //新增一欲滾動的ID,五個參數分別為
 //欲滾動的區塊ID,寬,高,速度,方向
 scrollBarControl.addBar("scrollbarDemo", 228, 120, 100, d);
 scrollBarControl.createScrollBars();
}
</SCRIPT>