MozTW 討論區

各項 Mozilla 相關軟體與技術討論
現在的時間是 2025-08-24, 03:26

所有顯示的時間為 UTC + 8 小時





發表新文章 回覆主題  [ 5 篇文章 ] 
發表人 內容
文章發表於 : 2005-01-02, 09:06 
離線

註冊時間: 2005-01-01, 22:14
文章: 9
在ie能夠轉色,mf不能
各大大幫我看看
js檔原文:
代碼:
/************************************************************************/
/* Rainbow Link Version 1.00 (1999.6.10)                                */
/*                                                                      */
/* Copyright (C) 1999-2001 TAKANASHI Mizuki                             */
/* takanasi@hamal.freemail.ne.jp                                        */
/*----------------------------------------------------------------------*/
/* Read it somehow even if my English text is a little wrong! ;-)       */
/*                                                                      */
/* Usage:                                                               */
/*  Insert '<script src="rainbow.js"></script>' into the BODY section,  */
/*  right after the BODY tag itself, before anything else.              */
/*  You don't need to add "onMouseover" and "onMouseout" attributes!!   */
/*                                                                      */
/*  If you'd like to add effect to other texts(not link texts), then    */
/*  add 'onmouseover="doRainbow();"' and 'onmouseout="stopRainbow();"'  */
/*  to the target tags.                                                 */
/*                                                                      */
/* This Script works with IE4 and above only, but no error occurs on    */
/* other browsers.                                                      */
/************************************************************************/


////////////////////////////////////////////////////////////////////
// Setting

var rate = 20;  // Increase amount(The degree of the transmutation)


////////////////////////////////////////////////////////////////////
// Main routine

var obj;        // The object which event occured in
var act = 0;    // Flag during the action
var elmH = 0;   // Hue
var elmS = 128; // Saturation
var elmV = 255; // Value
var clrOrg;     // A color before the change
var TimerID;    // Timer ID


if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) {
    Browser = true;
} else {
    Browser = false;
}

if (Browser) {
    document.onmouseover = doRainbowAnchor;
    document.onmouseout = stopRainbowAnchor;
}


//=============================================================================
// doRainbow
//  This function begins to change a color.
//=============================================================================
function doRainbow()
{
    if (Browser && act != 1) {
        act = 1;
        obj = event.srcElement;
        clrOrg = obj.style.color;
        TimerID = setInterval("ChangeColor()",100);
    }
}


//=============================================================================
// stopRainbow
//  This function stops to change a color.
//=============================================================================
function stopRainbow()
{
    if (Browser && act != 0) {
        obj.style.color = clrOrg;
        clearInterval(TimerID);
        act = 0;
    }
}


//=============================================================================
// doRainbowAnchor
//  This function begins to change a color. (of a anchor, automatically)
//=============================================================================
function doRainbowAnchor()
{
    if (Browser && act != 1) {
        obj = event.srcElement;

        while (obj.tagName != 'A' && obj.tagName != 'BODY') {
            obj = obj.parentElement;
            if (obj.tagName == 'A' || obj.tagName == 'BODY')
                break;
        }

        if (obj.tagName == 'A' && obj.href != '') {
            act = 1;
            clrOrg = obj.style.color;
            TimerID = setInterval("ChangeColor()",100);
        }
    }
}


//=============================================================================
// stopRainbowAnchor
//  This function stops to change a color. (of a anchor, automatically)
//=============================================================================
function stopRainbowAnchor()
{
    if (Browser && act != 0) {
        if (obj.tagName == 'A') {
            obj.style.color = clrOrg;
            clearInterval(TimerID);
            act = 0;
        }
    }
}


//=============================================================================
// Change Color
//  This function changes a color actually.
//=============================================================================
function ChangeColor()
{
    obj.style.color = makeColor();
}


//=============================================================================
// makeColor
//  This function makes rainbow colors.
//=============================================================================
function makeColor()
{
    // Don't you think Color Gamut to look like Rainbow?

    // HSVtoRGB
    if (elmS == 0) {
        elmR = elmV;    elmG = elmV;    elmB = elmV;
    }
    else {
        t1 = elmV;
        t2 = (255 - elmS) * elmV / 255;
        t3 = elmH % 60;
        t3 = (t1 - t2) * t3 / 60;

        if (elmH < 60) {
            elmR = t1;  elmB = t2;  elmG = t2 + t3;
        }
        else if (elmH < 120) {
            elmG = t1;  elmB = t2;  elmR = t1 - t3;
        }
        else if (elmH < 180) {
            elmG = t1;  elmR = t2;  elmB = t2 + t3;
        }
        else if (elmH < 240) {
            elmB = t1;  elmR = t2;  elmG = t1 - t3;
        }
        else if (elmH < 300) {
            elmB = t1;  elmG = t2;  elmR = t2 + t3;
        }
        else if (elmH < 360) {
            elmR = t1;  elmG = t2;  elmB = t1 - t3;
        }
        else {
            elmR = 0;   elmG = 0;   elmB = 0;
        }
    }

    elmR = Math.floor(elmR);
    elmG = Math.floor(elmG);
    elmB = Math.floor(elmB);

    clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16);

    elmH = elmH + rate;
    if (elmH >= 360)
        elmH = 0;

    return clrRGB;
}

網址是http://eternalwind.no-ip.com/bbs/index.php
設定了有連結就是用這段
套入是<script src="include/change.js"></script>
在body中


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-02, 09:43 
離線

註冊時間: 2005-01-01, 22:14
文章: 9
第2個問題,打印字體跟彩虹字體
大大請看
http://www.alan888.com/Discuz/viewthread.php?tid=4664
兩個htc檔其實是js檔
這個是rainbow
代碼:
<PUBLIC:COMPONENT URN="rainbow" name="darainbow()"/>
<PUBLIC:ATTACH  EVENT = "oncontentready" ONEVENT ="beginIt()"/>

<SCRIPT language="JAVASCRIPT">
var Kill_ID=null;
var internalValue;
var originalValue;
function putValue(){
  element.innerHTML=internalValue;
  encapsulate();
  startSwirl();
}
function eventHandler(){
  clearInterval(Kill_ID);
  internalValue=element.value;
  element.detachEvent("onpropertychange",eventHandler);
  if(event.propertyName=="value"){
    element.innerHTML=internalValue;
    putValue();
  } else startSwirl();   
  element.attachEvent("onpropertychange",eventHandler);   
}
function swirl(){
  var I;
  I=ran(internalValue.length-1,0);
  element.children(I).style.color=randomColor();

function startSwirl(){
  if (element.swirlInterval == null)
    element.swirlInterval=50;
  if ((internalValue!=null) && (element.swirlInterval!=0))
    Kill_ID=setInterval(swirl,element.swirlInterval);
}
function encapsulate(){
  var I;
  var tempStr="";
  for (I=0; I < internalValue.length; I++){
      tempStr += "<SPAN style=\"color:"+randomColor()+"\">" + internalValue.substr(I,1) + "</SPAN>";
    }
  innerHTML=tempStr;
}
function ran(upperbound, lowerbound){
  return(parseInt((upperbound - lowerbound + 1) * Math.random() + lowerbound));
}
function randomColor(){
  var R=ran(255,0);
  var G=ran(255,0);
  var B=ran(255,0);
  R=R.toString(16);
  G=G.toString(16);
  B=B.toString(16);
  if (R.length==1)  R="0"+R;
  if (G.length==1)  G="0"+G;
  if (B.length==1)  B="0"+B;
  return("#"+R+G+B);
}
function beginIt(){
  internalValue=element.value;
  originalValue=element.innerHTML;
  if (internalValue==null)
    internalValue=element.innerHTML;
  putValue();
  element.attachEvent("onpropertychange",eventHandler);
}
function clearIt(){
  clearInterval(Kill_ID);
  element.detachEvent("onpropertychange",eventHandler);
  element.innerHTML=originalValue; 
}
</script>

這個是typewriter
代碼:
<EVENT id=typewriter name=typewriter />
<ATTACH event=onload for=window handler=startTyping />
<method name=typeIt />
<property name=speed />
<script language="javascript">

var counter=0;
var buffer1;
var buffer2;
var bufLength;
var typing;
if (!speed) {var speed=100}

function startTyping(){
   buffer1 = element.innerText;
   element.innerText="";
   buffer2 = "";
   bufLength = buffer1.length;

   typing = window.setInterval(uniqueID+".typeIt()",speed);
}

function typeIt(){
   buffer2 = buffer2 + buffer1.substring(counter,counter+1);
   element.innerText = buffer2;
   counter = counter + 1;
   if (counter == bufLength){clearInterval(typing)}
}
</script>

http://eternalwind.no-ip.com/bbs/viewthread.php?fpage=1&tid=374
ie能看,firefox不能看
大大請幫忙


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-03, 16:18 
第一個問題:該 Script 本來就不接受非 Microsoft 系的 Browser !除非你把檢查 Browser 那段程式碼拿掉並適度修改內容。
第二個問題:先檢查 JavaScript 主控台有啥錯誤訊息,再對症下藥進行修正吧,光看 Code 我是看不出個所以然來的...


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.0; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-04, 16:08 
離線

註冊時間: 2005-01-01, 22:14
文章: 9
http://eternalwind.no-ip.com/bbs/viewth ... =1#pid1823
第一貼typewriter那兒...
應該一個個字走出來,但是就一次過出了
自行看...js主控台
看來這個是只支援M$IE的論壇程式...


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
文章發表於 : 2005-05-06, 18:58 
離線
[MozTW 版主群]
頭像

註冊時間: 2003-09-15, 03:47
文章: 1016
來自: Taiwan
Mozilla 可以利用 XBL 來支援 HTC
到 Google 找找看有沒有使用 XBL-HTC 的文章


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414
 個人資料  
引用回覆  
顯示文章 :  排序  
發表新文章 回覆主題  [ 5 篇文章 ] 

所有顯示的時間為 UTC + 8 小時


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 7 位訪客


不能 在這個版面發表主題
不能 在這個版面回覆主題
不能 在這個版面編輯您的文章
不能 在這個版面刪除您的文章
不能 在這個版面上傳附加檔案

搜尋:
前往 :  
Powered by phpBB® Forum Software © phpBB Group
正體中文語系由 竹貓星球 維護製作
© moztw.org, Mozilla Foundation
MozTW,Mozilla 台灣社群