如何修改程式碼讓每張圖能有各自的超連結

請會的大大教我一下咬怎樣修改下面的程式碼好讓每張圖都能有各自的超連結,或是能有淚是的程式碼能讓各自的圖能有超聯結,謝謝^^

<center>

<img name="_Ath_Slide" onload="OnImgLoad()">

<br>

<input type="button" name="btnPrev" value="<< 上一張" onclick="Prev();">

<input type="button" name="bntPlay" value="展示 / 停止" onclick="Play()">

<input type="button" name="btnNext" value="下一張 >>" onclick="Next();">

<br>

<b>圖案名稱:<SPAN id="_Ath_FileName"></SPAN></b>

<br>

<b>圖案數量:<SPAN id="_Ath_Img_X"></SPAN><strong>/</strong><SPAN id="_Ath_Img_N"></SPAN></b>

<script language="JavaScript1.2" event="onload" for="window">

<!--

main();

-->

</script>

<script language="JavaScript1.2">

<!--

g_fPlayMode = 0;

g_iimg = 0;

g_imax = 0;

g_ImageTable = new Array();

function ChangeImage(fFwd)

{

if (fFwd)

{

if (++g_iimg==g_imax)

g_iimg=0;

}

else

{

if (g_iimg==0)

g_iimg=g_imax;

g_iimg--;

}

Update();

}

function Update(){

document.all._Ath_Slide.src = g_ImageTable[g_iimg][0];

document.all._Ath_FileName.innerHTML = g_ImageTable[g_iimg][1];

document.all._Ath_Img_X.innerHTML = g_iimg + 1;

document.all._Ath_Img_N.innerHTML = g_imax;

}

function Play()

{

g_fPlayMode = !g_fPlayMode;

if (g_fPlayMode)

{

btnPrev.disabled = btnNext.disabled = true;

Next();

}

else

{

btnPrev.disabled = btnNext.disabled = false;

}

}

function OnImgLoad()

{

if (g_fPlayMode)

window.setTimeout("Tick()", g_dwTimeOutSec*1000);

}

function Tick()

{

if (g_fPlayMode)

Next();

}

function Prev()

{

ChangeImage(false);

}

function Next()

{

ChangeImage(true);

}

function main()

{

Update();

}

g_ImageTable[g_imax++] = new Array ("01.gif","QOO");

g_ImageTable[g_imax++] = new Array ("02.gif","機器人");

g_ImageTable[g_imax++] = new Array ("03.gif","皮卡丘");

g_ImageTable[g_imax++] = new Array ("04.gif","小熊維尼");

g_ImageTable[g_imax++] = new Array ("05.gif","小豬");

g_dwTimeOutSec=2

window.onload=Play

-->

</script>

</center>

1 Answer

Rating
  • 1 decade ago
    Favorite Answer

    <center>

    <a name="_Ath_Anchor"><img name="_Ath_Slide" onload="OnImgLoad()" border=0></a>

    <br>

    <input type="button" name="btnPrev" value="<< 上一張" onclick="Prev();">

    <input type="button" name="bntPlay" value="展示 / 停止" onclick="Play()">

    <input type="button" name="btnNext" value="下一張 >>" onclick="Next();">

    <br>

    <b>圖案名稱:<SPAN id="_Ath_FileName"></SPAN></b>

    <br>

    <b>圖案數量:<SPAN id="_Ath_Img_X"></SPAN><strong>/</strong><SPAN id="_Ath_Img_N"></SPAN></b>

    <script language="JavaScript" event="onload" for="window">main();</script>

    <script language=JavaScript>

    var g_fPlayMode = g_iimg = g_imax = 0;

    var g_ImageTable = new Array();

    function ChangeImage(fFwd)

    {

    if (fFwd)

    {

    if (++g_iimg==g_imax) g_iimg=0;

    }

    else

    {

    if (g_iimg==0) g_iimg=g_imax; g_iimg--;

    }

    Update();

    }

    function Update()

    {

    var oA=document.all;

    oA("_Ath_Anchor").href = g_ImageTable[g_iimg][2];

    oA("_Ath_Slide").src = g_ImageTable[g_iimg][0];

    oA("_Ath_FileName").innerHTML = g_ImageTable[g_iimg][1];

    oA("_Ath_Img_X").innerHTML = g_iimg + 1;

    oA("_Ath_Img_N").innerHTML = g_imax;

    }

    function Play()

    {

    if (g_fPlayMode = !g_fPlayMode)

    {

    btnPrev.disabled = btnNext.disabled = true; Next();

    }

    else

    {

    btnPrev.disabled = btnNext.disabled = false;

    }

    }

    function OnImgLoad()

    {

    if (g_fPlayMode) window.setTimeout("Tick()", g_dwTimeOutSec*1000);

    }

    function Tick() { if (g_fPlayMode) Next(); }

    function Prev() { ChangeImage(false); }

    function Next() { ChangeImage(true); }

    function main() { Update(); }

    //最後面加註連結的網址

    g_ImageTable[g_imax++] = new Array ("01.gif","QOO","http://x.y.z/01.htm%22);

    g_ImageTable[g_imax++] = new Array ("02.gif","機器人","http://x.y.z/02.htm%22);

    g_ImageTable[g_imax++] = new Array ("03.gif","皮卡丘","http://x.y.z/03.htm%22);

    g_ImageTable[g_imax++] = new Array ("04.gif","小熊維尼","http://x.y.z/04.htm%22);

    g_ImageTable[g_imax++] = new Array ("05.gif","小豬","http://x.y.z/05.htm%22);

    g_dwTimeOutSec=2;

    window.onload=Play;

    </script>

    </center>

    Source(s):
Still have questions? Get your answers by asking now.