廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 2604 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
long691216
數位造型
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[HTML][討論] 請問window.onload跟BODY onload會衝到該怎麼解決阿[以解決]
小弟是學網頁的新手  煩請哪一位大大教教小弟

第一個  這是一個閃爍文字的SCRIPT
<style>
<!--
#glowtext{
filter:glow(color=0A9DF5,strength=2);
width:100%;
}
-->
</style>
<script language="JavaScript1.2">
function glowit(which){
if (document.all.glowtext[which].filters[0].strength==2)
document.all.glowtext[which].filters[0].strength=1
else
document.all.glowtext[which].filters[0].strength=2
}
function glowit2(which){
if (document.all.glowtext.filters[0].strength==2)
document.all.glowtext.filters[0].strength=1
else
document.all.glowtext.filters[0].strength=2
}
function startglowing(){
if (document.all.glowtext&&glowtext.length){
for (i=0;i<glowtext.length;i++)
eval('setInterval("glowit('+i+')",150)')
}
else if (glowtext)
setInterval("glowit2(0)",150)
}
if (document.all)
window.onload=startglowing
</script>
<span id="glowtext"><font color="F5D20A" " face="細明體" size="3">熱門商品</font></span> <style>
<!--
#glowtext{
filter:glow(color=0A9DF5,strength=2);
width:100%;
}
-->
</style>
<script language="JavaScript1.2">
function glowit(which){
if (document.all.glowtext[which].filters[0].strength==2)
document.all.glowtext[which].filters[0].strength=1
else
document.all.glowtext[which].filters[0].strength=2
}
function glowit2(which){
if (document.all.glowtext.filters[0].strength==2)
document.all.glowtext.filters[0].strength=1
else
document.all.glowtext.filters[0].strength=2
}
function startglowing(){
if (document.all.glowtext&&glowtext.length){
for (i=0;i<glowtext.length;i++)
eval('setInterval("glowit('+i+')",150)')
}
else if (glowtext)
setInterval("glowit2(0)",150)
}
if (document.all)
window.onload=startglowing
</script>
<span id="glowtext"><font color="F5D20A" " face="細明體" size="3">熱門商品</font></span>


第二個   這是會跳出視窗的SCRIPT

<SCRIPT>
<!--
var flyingwin
var popupwidth=200
var popupheight=150
var marginright
var windowcenter
var i_top=200
var i_left=-popupwidth-50
var step=40
var timer
var waitingtime=5000
var pause=20

function showWindow() {
    flyingwin = window.open("", "flyingwin", "toolbar=no,width="+popupwidth+",height="+popupheight+",top=100,left="+(-popupwidth)+"");
    flyingwin.document.open();
    flyingwin.document.write("<html><title>自動離開的窗口</title><body><p align=center>請不要關閉,我馬上就自動滾蛋:(</body></html>");
    flyingwin.document.close();
   
    if (document.all) {
        marginright = screen.width+50
    }
    if (document.layers) {
        marginright = screen.width+50
    }
    windowcenter=Math.floor(marginright/2)-Math.floor(popupwidth/2)
    movewindow()
       
}

function movewindow() {
        if (i_left<=windowcenter) {
              flyingwin.moveTo(i_left,i_top)
              i_left+=step
              timer= setTimeout("movewindow()",pause)
        }
        else {
              clearTimeout(timer)
              timer= setTimeout("movewindow2()",waitingtime)
        }
}

function movewindow2() {
        if (i_left<=marginright) {
              flyingwin.moveTo(i_left,i_top)
              i_left+=step
              timer= setTimeout("movewindow2()",pause)
        }
        else {
              clearTimeout(timer)
              flyingwin.close()
        }
}

// -->
</SCRIPT>
<BODY onload=showWindow()></BODY>


小弟真的不懂body onload 跟window.onload  會衝到的原因  希望各位能給小弟一點意見

感激不盡

表情


[ 此文章被kc715在2005-03-28 13:21重新編輯 ]



獻花 x0 回到頂端 [樓 主] From:台灣中華電信 | Posted:2005-03-28 05:47 |
kc715 手機
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x0 鮮花 x73
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

請參考附件的原始檔內容....

基本上並沒有衝到喔..............


本帖包含附件
txt test.htm.txt   (2022-06-09 14:01 / 3 KB)   下載次數:14


小弟的拙作,如何救回誤刪的資料

資料搶救大作戰!教您用Finaldata Enterprise2

進階認識代理伺服器proxy

======================

度德以處之,量力而行之,相時而動。
明恕而行,要之以禮。

======================
獻花 x0 回到頂端 [1 樓] From:台灣中華電信 | Posted:2005-03-28 13:20 |
long691216
數位造型
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

下面是引用kc715於2005-03-28 13:20發表的 :
請參考附件的原始檔內容....

基本上並沒有衝到喔..............

可是字不會動阿   還有視窗也不會出現   好無奈喔   

//自動離開的窗口
<SCRIPT>
<!--
var flyingwin
var popupwidth=200
var popupheight=150
var marginright
var windowcenter
var i_top=200
var i_left=-popupwidth-50
var step=40
var timer
var waitingtime=5000
var pause=20

function showWindow() {
     flyingwin = window.open("", "flyingwin", "toolbar=no,width="+popupwidth+",height="+popupheight+",top=100,left="+(-popupwidth)+"");
     flyingwin.document.open();
     flyingwin.document.write("<html><title>自動離開的窗口</title><body><p align=center>請不要關閉,我馬上就自動滾蛋:(</body></html>");
     flyingwin.document.close();
     
     if (document.all) {
           marginright = screen.width+50
     }
     if (document.layers) {
           marginright = screen.width+50
     }
     windowcenter=Math.floor(marginright/2)-Math.floor(popupwidth/2)
     movewindow()
           
}

function movewindow() {
           if (i_left<=windowcenter) {
                 flyingwin.moveTo(i_left,i_top)
                 i_left+=step
                 timer= setTimeout("movewindow()",pause)
           }
           else {
                 clearTimeout(timer)
                 timer= setTimeout("movewindow2()",waitingtime)
           }
}

function movewindow2() {
           if (i_left<=marginright) {
                 flyingwin.moveTo(i_left,i_top)
                 i_left+=step
                 timer= setTimeout("movewindow2()",pause)
           }
           else {
                 clearTimeout(timer)
                 flyingwin.close()
           }
}
</SCRIPT>
<BODY onload=showWindow()></BODY>



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

//心跳樣式的文字

<style>
<!--
#glowtext{
filter:glow(color=0A9DF5,strength=2);
width:100%;
}
-->
</style>
<script language="JavaScript1.2">
function glowit(which){
if (document.all.glowtext[which].filters[0].strength==2)
document.all.glowtext[which].filters[0].strength=1
else
document.all.glowtext[which].filters[0].strength=2
}
function glowit2(which){
if (document.all.glowtext.filters[0].strength==2)
document.all.glowtext.filters[0].strength=1
else
document.all.glowtext.filters[0].strength=2
}
function startglowing(){
if (document.all.glowtext&&glowtext.length){
for (i=0;i<glowtext.length;i++)
eval('setInterval("glowit('+i+')",150)')
}
else if (glowtext)
setInterval("glowit2(0)",150)
}
if (document.all)
window.onload=startglowing
</script>
<span id="glowtext"><font color="F5D20A" " face="細明體" size="3">心跳樣式的文字</font></span>


單獨都可以執行   但是串在一起自動消失的視窗不會出來  文字也不會閃爍

麻煩大大幫小弟解惑一下


獻花 x0 回到頂端 [2 樓] From:台灣中華電信 | Posted:2005-03-28 15:09 |
kc715 手機
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x0 鮮花 x73
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

您好,小妹認為這一段應該放在<body> </body>之間

<span id="glowtext"><font color="F5D20A" " face="細明體" size="3">熱門商品</font></span> <style>
<!--
#glowtext{
filter:glow(color=0A9DF5,strength=2);
width:100%;
}
-->
</style>

因為<BODY>內含的是網頁顯示的內容.....
基本上你的原始碼本身沒啥問題

我樓上那篇就是這樣放的


小弟的拙作,如何救回誤刪的資料

資料搶救大作戰!教您用Finaldata Enterprise2

進階認識代理伺服器proxy

======================

度德以處之,量力而行之,相時而動。
明恕而行,要之以禮。

======================
獻花 x0 回到頂端 [3 樓] From:台灣中華電信 | Posted:2005-03-28 15:34 |
xxxzzz
個人頭像
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x0 鮮花 x46
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

我直接改kc715大大的
試試下面的代碼..兩種效果都有
重點在於把會閃的代碼放在</body>後面
然後把window.onload=startglowing
改成startglowing();

沒有很仔細看...應該還有其他方法
複製程式
<style>
<!--
#glowtext{
filter:glow(color=0A9DF5,strength=2);
width:100%;
}
-->
</style>
<style>
<!--
#glowtext{
filter:glow(color=0A9DF5,strength=2);
width:100%;
}
-->
</style>
<SCRIPT>
<!--
var flyingwin
var popupwidth=200
var popupheight=150
var marginright
var windowcenter
var i_top=200
var i_left=-popupwidth-50
var step=40
var timer
var waitingtime=5000
var pause=20

function showWindow() {
    flyingwin = window.open("", "flyingwin", "toolbar=no,width="+popupwidth+",height="+popupheight+",top=100,left="+(-popupwidth)+"");
    flyingwin.document.open();
    flyingwin.document.write("<html><title>自動離開的窗口</title><body><p align=center>請不要關閉,我馬上就自動滾蛋:(</body></html>");
    flyingwin.document.close();
    
    if (document.all) {
        marginright = screen.width+50
    }
    if (document.layers) {
        marginright = screen.width+50
    }
    windowcenter=Math.floor(marginright/2)-Math.floor(popupwidth/2)
    movewindow()
        
}

function movewindow() {
        if (i_left<=windowcenter) {
              flyingwin.moveTo(i_left,i_top)
              i_left+=step
              timer= setTimeout("movewindow()",pause)
        }
        else {
              clearTimeout(timer)
              timer= setTimeout("movewindow2()",waitingtime)
        }
}

function movewindow2() {
        if (i_left<=marginright) {
              flyingwin.moveTo(i_left,i_top)
              i_left+=step
              timer= setTimeout("movewindow2()",pause)
        }
        else {
              clearTimeout(timer)
              flyingwin.close()
        }
}

// -->
</SCRIPT> 

<BODY onload="showWindow();">
<span id="glowtext"><font color="F5D20A" " face="細明體" size="3">熱門商品</font></span>

</BODY>
<script language="JavaScript1.2">
function glowit(which){
if (document.all.glowtext[which].filters[0].strength==2)
document.all.glowtext[which].filters[0].strength=1
else
document.all.glowtext[which].filters[0].strength=2
}
function glowit2(which){
if (document.all.glowtext.filters[0].strength==2)
document.all.glowtext.filters[0].strength=1
else
document.all.glowtext.filters[0].strength=2
}
function startglowing(){
if (document.all.glowtext&&glowtext.length){
for (i=0;i<glowtext.length;i++)
eval('setInterval("glowit('+i+')",150)')
}
else if (glowtext)
setInterval("glowit2(0)",150)
}
if (document.all)
startglowing();
</script>

此文章被評分,最近評分記錄
財富:10 (by kc715) | 理由: 熱心回答會員問題^^


獻花 x0 回到頂端 [4 樓] From:台灣亞太線上 | Posted:2005-03-28 17:12 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.017462 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言