2010-12-10 2 views
0

に時間間隔を置くために、それは、この関数からランダムリンクするたびに生成されますように私は、間隔を入れたい:どのようにランダムな画像変化

function random_imglink(){ 
    var myimages=new Array() 
    //specify random images below. You can have as many as you wish 
    myimages[1]="/documents/templates/bilgiteknolojileri/standalone.swf" 
    myimages[2]="/documents/templates/bilgiteknolojileri/mobil.swf" 
    myimages[3]="/documents/templates/bilgiteknolojileri/3b2.swf" 

    var ry=Math.floor(Math.random()*myimages.length) 

    if (ry==0) 
    ry=1 
    document.write('<embed wmode="transparent" src="'+myimages[ry]+'" height="253" width="440"></embed>') 
    } 
    random_imglink() 

が、問題は後に、私は統合するということですそれだけで埋め込みオブジェクトを示して2秒後にこの

random_imglink() 
    setInterval("random_imglink()", 2000); 

ようFUNCにタイムアウト、私は、ページに表示されるだけの事を意味埋め込みオブジェクトは、..ですすべてのthatsし、別の2秒後にそれはdoesnのオブジェクトを変更する...私が望むのは、埋め込みオブジェクト内のリンクだけを変更することですeページビジョン、助けてください!

答えて

0

埋め込みオブジェクトをタイムアウトに書き込むのではなく、そこに上書きしてください。

直接HTMLに埋め込みオブジェクトを追加します。

<embed id="randomEmbed" ...other parameters...></embed> 

その後、あなたのタイマー機能では、このような何かへの書き込みを変更します。

document.getElementById("randomEmbed").src = myimages[ry]; 
関連する問題