¦^«e­¶

´`Àô¸ü¤Jºô­¶¡Glocation.href Äݩʪº¨Ï¥Î½d¨Ò(1)

META ¼ÐÅÒ´`Àô¸ü¤Jºô­¶
´`Àô¸ü¤Jºô­¶¹ïÂsÄýªÌ§Ö³tªºÀò±o¤@­Óºô¯¸ªº¤j²¤¤º®e¡A¬O«D±`¦n¥Îªº¤@ºØ¾ÉÄý ¤èªk¡C¨ä¹ê¤£¥Î Script ¡A³æ¯Âªº HTML ¡A¥u­n¨Ï¥Î META ¼ÐÅÒ HTTP-EQUIV="refresh" Äݩʪº³]©w¡A´N¥i¥H³]©w¼È°±®É¶¡¡A¤Î¤U¤@­Óºô­¶ªº¦ì§}¡A ¨ä¼gªk¦p¤U¡G
<meta http-equiv="refresh" content="20; url=±ý³sµ²ºô­¶.htm">
<!--
http-equiv="refresh"¡Gªí¥Üºô­¶¦Û°Ê§ó·s
content="20;......¡Gªí¼È°± 20 ¬í«á¶}©l§ó·s°Ê§@
url=±ý³sµ²ºô­¶.htm¡Gªí§ó·s«á¸ü¤Jªººô­¶¡A¦pªG¨S¦³³]©w¡Aªí¥Ü­«·s¸ü¤J­ìºô­¶¡C
// -->
¤W­±³oºØ¼gªk¡AIE ©M NS ³£¦³¤ä´©¡A¨º»ò»Ý­n´`Àô¼½©ñ®É¡A¥u»Ý­n¦b¨C±iºô­¶ªº¼ÐÀY ºô­¶³]¦n¥¦ªº¤U±iºô­¶¦ì§}¤Î¼È°±®É¶¡¡A¨º»ò´N¥i§Î¦¨¤@²Õ´`Àô¼½©ñªººô­¶¡C
¥Î Script ¼È°±¼½©ñ
¥Î META ¼ÐÅÒÁö¥i¹F¦¨´`Àô¼½©ñ¡A¦ý¦b Netscape ¤¤«o¬OµLªk¤¤Â_³o­Ó´`Àôªº (IE ¥i«ö[°±¤î]¹Ï¥Ü¶s¨Ó¤¤Â_)¡A¦]¦¹­n¬J¯à´`Àô¼½©ñ¡A¤S¯à¥ÑÂsÄýªÌ¦Û¥Ñ¤¤Â_´`Àô¡A ´N¥²¶·¥[¤J Script ¨Ó±±¨î¡CÄ´¦p§A¥i¥Î¤U­±ªº±Ô­z¨Ó¹j¤@Â_®É¶¡«á¸ü¤J¤U¤@­¶¡G
<SCRIPT>
    var timer;
    function LoadNextPage() {location.href="NewPageURL";}
    function Initialize() {timer=setTimeout("LoadNextPage()",5*1000);}
</SCRIPT>

<BODY onload="Initialize()">
    ...... ¨ä¥Lºô­¶¤º®e ......
</BODY>

/* 1.¥Î LoadNextPage ¦Û­q¨ç¼Æ¥h¸ü¤J¤U¤@­Óºô­¶¡C
   2.BODY onload="Initialize()" ºô­¶¤U¸ü§¹¦¨«h°õ¦æªì©l¤Æ¡C
   3.var timer=setTimeout ªí¥Ü¥ÎÅÜ¼Æ timer ¥h«Å§i±Ò¥Î¤@­Ó®É¶¡¶¡¹jÅX°Ê¾¹¡C
   4.setTimeout() ¤èªkªº²Ä¤@­Ó°Ñ¼Æ¬O¶Ç¤J®É¶¡¨ì®É¡A­n°õ¦æªº¨ç¼Æ¦WºÙ¦r¦ê¡C
   5.setTimeout() ¤èªkªº²Ä¤G­Ó°Ñ¼Æ¬O¼È°±ªº²@¬í¼Æ¡A10*1000 ªí¥Ü¼È°± 10 ¬í¡C
*/
¦Ó¤¤Â_³o­Ó§ó·s¸ü¤Jªº°Ê§@«h¥i¥H³o»ò¼g¡G
function StopLoadNextPage() {clearTimeout(timer);}

/* «Å§i°±¤î¸ü¤J·sºô­¶ªº¦Û­q¨ç¼Æ¡A­ì²z¬O­É clearTimeout() ¤èªk²×¤î
   ®É¶¡¶¡¹jÅX°Ê¾¹ timer ªº¨Ï¥Î¡A¬JµM timer ³Q²×¤î¡A·íµM´N¤£·|¨ì¤F
   ®É¶¡¥h°õ¦æ LoadNextPage() ªº°Ê§@¡C */
¦Ü©ó³o­Ó StopLoadNextPage() ©M LoadNextPage() ¤£¦Pªº¬O¡ALoadNextPage ¬O¥Ñ Script ¦Û¦æ±Ò°Êªº¡A¦Ó StopLoadNextPage «h¥²¶·¥æ¥ÑÂsÄýªÌ¾Þ§@¨Ó±Ò°Ê¡C¨Ò¦p §A¥i¥H¥Î³o¼Ëªº HTML ³]©w¡G
<A HREF="#" onclick="StopLoadNextPage();return false;">²×¤î´`Àô</A>
¦p¦¹¥u­n¦b timer ±Ò°Ê LoadNextPage ¤§«e¡AÂsÄýªÌ¥ý«ö¤U [²×¤î´`Àô] ªº link ¡A ¨º»ò¾ã²Õ´`Àôºô­¶°Ê§@´N·|³Q°±¤î¤U¨Ó¡C
±±¨î­¶»PÅã¥Ü­¶¤ÀÂ÷
«e­±´£ªº´`Àô¼½©ñºô­¶ªº¤èªk¡AÁÙ¬O¦³¤U¦C´X¶µ¯ÊÂI¡G
  1. ¨C­Ó´`Àôºô­¶²Õªº¦¨­û³£¥²¶·¦³¦Û°Ê¸ü¤J¤U¤@­¶ªº»yªk³]©w¡A¦]¦¹ºc¦¨ ´`Àôªº¨C­Óºô­¶¥²¶·¯S§O³]­p¡AµLªk¨Ï¥Î¤w¦s¦bªº¤@¯ëºô­¶¡C
  2. ¨C­Ó´`Àôºô­¶ªº¼½©ñ¦¸§Ç¬O©T©wªº¡A¦pªG­n§ïÅܨ䤤´X­¶ªº¼½©ñ¦¸§Ç¡A¥²¶· ©Ò¦³¦¨­ûªº¤U¤@­¶³]©w³£­n¸òµÛ§ïÅÜ¡AÅܤƧxÃø¡C
­n§ïµ½³o¨Ç¯ÊÂIªº±©¤@¿ìªk¡A´N¬O§â©Ò¦³´`Àô¼½©ñªº³]©w±q­Ó§Oªº´`Àô²Õºô­¶¤¤©âÂ÷ ¡A¦Ó§â¥¦­Ì¶°¤¤¦b¤@±iºô­¶¤¤³]©w¡A¤]´N¬O¥Î¤@±i±±¨î­¶¥h±±¨î©Ò¦³´`Àô²Õºô­¶ªºÅã¥Ü ¡A¥u¦³±±¨î­¶¦³´`Àô¼½©ñ³]©w¡A¨ä¥LÅã¥Ü­¶¥u¬O³æ¯Âªº­t³d¤º®e§e²{¦Ó¤w¡C­n¹F¦¨³o­Ó ¥Øªº¡A¤]¦³­Ó¥ý¨M±ø¥ó¡A¨º´N¬O±±¨î­¶¤£¯à³Q¸ü¥Xªº±¡ªp¤U¡AÅã¥Ü­¶­n¦P®É³Q¸ü¤J¡C ¦pªG§Ú­Ì¤£­n¥h¦Ò¼{ IE IFRAME ©M NS LAYER ³o»ò½ÆÂøªºªF¦è¡A¯Â¥H¼Ð·Çªº HTML ¼ÐÅÒ ¨Ó¦Ò¼{¡A¨º»ò§Ú­Ì¤@©w­n¦³¨â­Ó window ¨Ó¦P®É®e¯Ç±±¨î­¶©MÅã¥Ü­¶¡A¦]¦¹§Ú­Ì¥i¥H¦³ ¨Ï¥Î FRAMESET ®Ø¬[²Õ©M window.open() ¤èªk¶}¤l¥À window ¨âºØ¤èªk¡C¥»½d¨Ò­«¦b Æ[©À¸Ñ»¡¡A¦]¦¹±Ä¥Î¤ñ¸û³æ¯Âªº FRAMESET ¤è¦¡¡A±N¨Ó¦³¾÷·|°µ§ó¦nÅã¥Ü®ÄªGªº ºô­¶§ë¼v¾÷®É¡A¦A¬°¦U¦ì¥Ü½d¤l¥À window ªº°µªk¡C
´`Àô¼½©ñ¾¹ªººô­¶²Õ¦¨
¥»½d¨Ò´`Àô¼½©ñ¾¹¬O¥Ñ¤U¦Cºô­¶µ²ºc²Õ¦¨¤W¤U¨â­Ó window¡A¨Ó¦P®É®e¯Ç±±¨î­¶©M Åã¥Ü­¶¨â­Óºô­¶¡C
<frameset rows="50,*">
    <frame src="slider.htm" name="Slider" noresize scrolling=no BORDER="0" FRAMEBORDER="NO" FRAMESPACING="0">
    <frame src="preview.htm" name="Viewer" noresize scrolling=Auto BORDER="0" FRAMEBORDER="NO" FRAMESPACING="0">
</frameset>
<!--
  ®Ø¬[²Õ³]©w­¶¦WºÙ¡Gloopfrm.htm
  ±±¨î­¶¡Gslider.htm
  Åã¥Ü­¶¡Gpreview.htm
// -->
slider.htm ¬O­t³d°O¿ý¨Ã±±¨î©Ò¦³ªº´`Àô²Õºô­¶¡A¥¦¦b¼½©ñºô­¶®É¥²¶·¨Ï²×±¾¦b frame slider ùØ¡A¦Ó preview.htm ¥u¬O¦b frame Viewer ¤¤Åã¥Ü¤@¨Ç¾Þ§@»¡©ú¡A¤@¥¹ ¼½©ñ¶}©l¡A´N·|³Q¨ä¥L¼½©ñºô­¶¨ú¥N¡A¦Ü©ó frame Viewer ùتººô­¶¡A«h¬O«ö®É¶¡¶¡¹j ¡A¤£°±©â´«ªº¡C
¦b frame ¤¤¾Þ§@¥t¤@­Ó frame
¬JµM©Ò¦³ªº¼½©ñ³]©w³£¦b slider.htm ªººô­¶ùØ¡A¨º»ò§Ú­Ì­n«ç¼Ë¦b frame Slider ¤¤ ¾Þ§@ frame Viewer ªººô­¶¸ü¤J©O¡H³Ì²³æªº¤èªk´N¬O¦b slider.htm ªº Script ±Ô­z ¤¤«Å§i¤@­ÓÅܼơA¥h°Ñ·Ó¨ì frame Viewer ªººô­¶¸ü¤Jª«¥ó¡AµM«á´N¥i¥H¦b frame Slider ¤¤­É¥Ñ¾Þ§@°Ñ·ÓÅܼƥh±±¨î frame Viewer ªº°Ê§@¡AÄ´¦p¥»½d¨Òªº Script ±Ô­z¬O³o¼Ëªº¡G
var slideLoader;

/* DHTML ºô­¶ªì©l¤Æ³]©w */
function Initialize()
{
    slideLoader=parent.frames.Viewer.location;
    /* ¥ÎÅÜ¼Æ slideLoader °Ñ·Ó®Ø¬[²Õ¤¤ frame Viewer ¸ü¤Jºô­¶ª«¥ó«á¡A
       ´N¥i¥H¥Î slideLoader.href="·sºô­¶ªº URL" ªº»yªk¡A
       ¦b frame Viewer ¤¤¸ü¤J·sºô­¶¡C */

    /* ......  ¨ä¥L Script ±Ô­z  ...... */
}
¦p¦ó³]©w´`Àô²Õ¤§¦Uºô­¶¸ô®|
¬JµM§Ú­Ì¥i¥Î slideLoader.href="·sºô­¶ªº URL" ªº»yªk¦b frame Viewer ¤¤¸ü¤J ·sºô­¶¡A¨º»ò¦p¦ó¤£¥u¸ü¤J¤@¥÷ºô­¶¡A¦Ó¬O¸ü¤J¤@²Õºô­¶¡A¿ìªk´N¦h¤F¡A¤£¹L¦]¬° Script ¸ê®Æ¤º®e§ó§ï¤£©ö¡A©Ò¥H¥»½d¨Ò·Q¥Ü½d­Ó°µªk¡A´N¬O§â Script ªº°}¦C¸ê®Æ¡A ¤£¥Î«Å§i Script °}¦CÅܼơA¦Ó¬Oª½±µ¥Î HTML ¼ÐÅÒ¨Ó²Õ¦¨¡C¦n³B¬O´Nºâ¤£À´ Script ªº¤H¡A¥u­n·|¥Î HTML ¡A¤@¼Ë¥i¥H¦w±Æ´`Àôºô­¶ªº¼½¥X¤è¦¡¡C¥»½d¨Ò HTML ¦p¤U¡G
<FORM NAME="setting">
    <!-- ... ¨ä¥L TAG ³]©w ... // -->

    <!-- §â©Ò¦³­n´`Àô¼½©ñªººô­¶°O¿ý¦b³o­Ó Option ¶°¦Xª«¥óªº text ÄÝ©ÊùØ // -->
    <SELECT NAME="slides">
        <OPTION ...>´`Àôºô­¶¤@ URL</OPTION>
        <OPTION ...>´`Àôºô­¶¤G URL</OPTION>
        <OPTION ...>´`Àôºô­¶¤T URL</OPTION>
    <!-- ... ¨ä¥L OPTION ³]©w ... // -->
    </SELECT>
</FORM>
·í§A¥Î³o¼Ë¤è¦¡ªº²Õ¦¨§Aªººô­¶´`Àô¼½©ñ²Õ«á¡A§A´N¥i¥H¥Î³o¼Ëªº Script ¥h¤@¤@°õ¦æ ¨C¤@­¶ªº¸ü¤J¡G
var slideCollect,totalslide;

    /* ¥Î slideCollect Åܼƥh°Ñ·Óªí³æ slides ùتº option ¶°¦X */
    slideCollect=document.forms.setting.elements.slides;

    /* ´`Àôºô­¶¼Æ¶qµ¥©ó option ¶°¦XÁ`¼Æ¶q */
    totalslide=slideCollect.length;

    for (var i=0;i<totalslide;i++)
    { slideLoader.href=slideCollect[i].text;}
®É¶¡¼È°±¶¡¹j¾¹ªº¨Ï¥Î
¨ä¹ê«e¤@¤p¸`¥Î for °j°é¥h³v¤@¸ü¤J´`Àô­¶¡AÁöµM¬O³B²z°}¦C©Î¶°¦Xªº°ò¥»·§©À¡A ¦ý¦b¹ê¥Î¤W¥i´N¤£¯à¯u³o»ò°µ¡A¦]¬°³o¼Ëªº±Ô­zÁöµM·|¨Ì¦¸§Ç¸ü¤Jºô­¶¡A¦ý¦b§AÁÙ¨S ¬Ý²Mºô­¶®É¡A¥¦´N¤w¸gÂà¦Ó¸ü¤J¤U¤@¥÷ºô­¶¤F¡C©Ò¥HÁöµM§Ú­Ì¤´­n¥Î°j°é³B²zºô­¶¸ü¤J ¡A¦ý¥²¶·­nÅý¸ü¤Jªººô­¶¦b¸ü¤J«á¡A¦b frame Viewer ¤¤°±¤@¤U¤l¡A¦A¸ü¤J¤U¤@¥÷ºô­¶ ¡C­n¹F¦¨³o­Ó¥Ø¼Ð¡A«h¥²¶·¹³§Ú­Ì¦b [¥Î Script ¼È°±¼½©ñ] ¤@¸`©Ò»¡ªº¡A¨Ï¥Î setTimeout() ¤èªk«Å§i¤@­Ó®É¶¡¼È°±¶¡¹j¾¹ªº¨Ï¥Î¡AÄ´¦p¥»½d¨Ò°õ¦æ¼½©ñ¨ç¼Æ¬O¦p¤U ³]­pªº¡G
/* ¼½©ñºô­¶»¼¼WÅÜ¼Æ */
var nowno=0;

function SlideShow()
{
    // ... ¨ä¥L Script ±Ô­z ...
    slideLoader.href=slideCollect[nowno].text;
    timer=setTimeout("SlideShow()",¼È°±¶¡¹jªº²@¬í¼Æ);
    nowno++;
    // ... ¨ä¥L Script ±Ô­z ...
}
¦]¬°¨C°õ¦æ SlideShow() ¤@¦¸¡AsetTimeout() ´N·|³Q³]©w¦A©I¥s¦Û¤v°õ¦æ¤@¦¸¡A ¨Ã¥B»¼¼WÅܼƥ[¤@¡A¦]¦¹´N¯à´`§Çªº¼½©ñ©Ò¦³ªºÀɮסC
¨C­¶¼È°±®É¶¡¤À§O³]©w
¦³¤F¤W­±´X¤p¸`ªº¬[ºc«á¡A°ò¥»¤Wºô­¶´`Àô¼½©ñ¾¹´N¤w¸g¥i¥H¹B§@¤F¡A¦ý¦pªG§Ú­Ì ¦b SlideShow() ¤¤§â¼È°±¶¡¹jªº²@¬í¼Æµ¹¼g¦º¤F¡A¨º´N©Ò¦³´`Àô­¶¼È°±®É¶¡³£¤@¼Ë¤F¡A ¦pªG§Ú­Ì§Æ±æ¤£¦Pªººô­¶¦³¤£°±ªº¼È°±®É¶¡«ç»ò¿ì¡H³o¤]¤£Ãø¡A¦]¬°­è­èªº OPTION Äݩʤ¤¡A§Ú­Ì¥u¥Î¤F text ÄݩʡA¦Ó¨S¦³¥Î¨ì value ÄݩʡA©Ò¥H§Ú­Ì¥i¥H§â­Ó§Oºô­¶ ªº¼È°±®É¶¡¼g¦b OPTION VALUE ùØ¡A¦p¡G
<FORM NAME="setting">
    <!-- ... ¨ä¥L TAG ³]©w ... // -->

    <!-- ºô­¶¤@¼È°± 10 ¬í¡Aºô­¶¤G¼È°± 20 ¬í¡Aºô­¶¤T¼È°± 15 ¬í¡C  // -->
    <SELECT NAME="slides">
        <OPTION VALUE="10">´`Àôºô­¶¤@ URL</OPTION>
        <OPTION VALUE="20">´`Àôºô­¶¤G URL</OPTION>
        <OPTION VALUE="15">´`Àôºô­¶¤T URL</OPTION>
    <!-- ... ¨ä¥L OPTION ³]©w ... // -->
    </SELECT>
</FORM>
µM«á§Ú­Ì¦b SlideShow() ¤¤§ï¼g¦p¤U¡G
/* ¼½©ñºô­¶»¼¼WÅÜ¼Æ */
var nowno=0;

function SlideShow()
{
    // ... ¨ä¥L Script ±Ô­z ...
    slideLoader.href=slideCollect[nowno].text;
    timer=setTimeout("SlideShow()",parseInt(slideCollect[nowno].value)*1000);
    nowno++;
    // ... ¨ä¥L Script ±Ô­z ...
}
¼½©ñ¤@¦¸ªº°j°é¤¤¤î¤è¦¡
«e­±ªº SlideShow() ¨ç¼Æ¨ä¹êÁÙ¬O¤@­Ó¤£§¹¾ãªº±Ô­z¡A¦]¬°¥¦·|³´¤J»¼¼WÅܼƶW¹L slideCollect Á`¼Æ¡A±q¦Ó¾É­P¿ù»~²£¥Íªº Bug ¤¤¡C ©Ò¥H«ç¼Ë¦b»¼¼WÅܼƶW¹L slideCollect Á`¼Æ«e²×¤î°õ¦æ¡A¦³¨â­Ó¿ìªk¡A¤@­Ó¬Oµ{¦¡ ¦Û°Ê¤¤¤î¡A¤@­Ó¬O¨Ï¥ÎªÌ¾Þ§@¤¤¤î¡A¥ý¨Ó»¡²Ä¤@­Ó¡C¤j©è¤W§Ú­Ì§Æ±æ¾ã­Ó´`Àô²Õ¼½©ñ ¤@¦¸¦Û°Ê¤¤¤î¡A«h§Ú­Ì·|±Ä¥Îµ{¦¡¦Û°Ê¤¤¤î¡C¦pªG¬O­n°µ¦¨³o¼Ëªº¥\¯à¡A§Ú­ÌÀ³§â SlideShow() ­×§ï¦p¤U¡G
/* ¼½©ñºô­¶»¼¼WÅÜ¼Æ */
var nowno=0;

function SlideShow()
{
    /* ²M°£¼È°±¶¡¹j¾¹ª«¥óªº­ì³]©w */
    clearTimeout(timer);

    if (nowno<slideCollect.length)
    {
        slideLoader.href=slideCollect[nowno].text;
        timer=setTimeout("SlideShow()",parseInt(slideCollect[nowno].value)*1000);
        nowno++;
    }
    // ... ¨ä¥L Script ±Ô­z ...
}
¦p¦¹³]­p¥Î·N¬O¦¸°õ¦æ SlideShow() ®É³£·|¥ý¨ú®ø¼È°±¶¡¹j¾¹ª«¥ó¡A¦Ó¥B¥u¦³¦b »¼¼WÅܼƤp©ó slideCollect Á`¼Æ®É¡A¤~·|­n¨D¼È°±¶¡¹j¾¹©I¥s¦Û¤v¦A¦¸°õ¦æ¡C
µL­­¼½©ñªº°j°é¤¤¤î¤è¦¡
²Ä¤GºØ³]­p²z©À¬O¤£°±ªº´`Àô©ñ¡A©ñ¨ìÂsÄýªÌ¤¤¤î¬°¤î¡C§Ú­Ì¥ý½Í¦p¦óÅý´`Àôºô­¶ ©ñ­Ó¨S§¹¨S¤F¡A¤S¤£·|²£¥Í»¼¼WÅܼƶW¹L slideCollect Á`¼Æ¾É­Pªº¿ù»~¡C§Ú­Ì¥i¥H ¦A§ï SlideShow()¬°¡G
/* ¼½©ñºô­¶»¼¼WÅÜ¼Æ */
var nowno=0;

function SlideShow()
{
    /* ²M°£¼È°±¶¡¹j¾¹ª«¥óªº­ì³]©w */
    clearTimeout(timer);

    if (nowno<slideCollect.length)
    {
        slideLoader.href=slideCollect[nowno].text;
        timer=setTimeout("SlideShow()",parseInt(slideCollect[nowno].value)*1000);
        nowno++;
    }
    else;
    { nowno=0;SlideShow();}
}
¹ï°Õ¡A´N¬O³o»ò²³æ¡A·í»¼¼WÅܼƶW¹L slideCollect Á`¼Æ®É¡A§â¼½©ñºô­¶»¼¼WÅÜ¼Æ Âk¹s¡A­«·s°õ¦æ¤@¦¸§Y¥i¡C¦Ü©óµL­­¼½©ñªº¥D­nÅX°Ê¾¹¬O¼È°±¶¡¹j¾¹ª«¥ó timer ¦bÅX°Êªº¡A¦]¦¹«Å§i¨äµL®Ä§Y¥i¡A¦p§A¥i°µ¤@­Ó¥i¨ÑÂsÄýªÌ©I¥s¤§²×¤î¼½©ñ¨ç¼Æ¦p¤U¡G
function StopLoop()
{
    /* ²M°£¼È°±¶¡¹j¾¹ª«¥óªº­ì³]©w */
    clearTimeout(timer);
}
µM«á¦b HTML ùذµ­Ó©I¥s¬É­±¦p¡G
<A HREF="#" onclick="StopLoop();return false;">²×¤î¼½©ñ</A>
§Y¥i¤¤Â_¶i¦æ¤¤ªº¼½©ñ¡C
¶}±Ò½d¨Òºô­¶
¦n°Õ¡IÅo¶Û¤@¤j°ï¡A´NÅý§Ú­Ì¬Ý¬Ý®ÄªG¦p¦ó¡A §A¥i¥H¶}±Òºô­¶´`Àô¼½©ñ¾¹¡A©ÎªÌ±N¬ÛÃöºô­¶ ¥´¥]¤U¸ü¡AÂ÷½u¾\Ū¡C

¦^«e­¶
1