połączenie dwóch kodów - bannerów ze skryptem losowym

Inne  Założony przez  Topielec.

wersja skryptu MyBB:
adres forum: http://cichlidae.pl
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu):

Otóż potrzebowałbym pomocy w połączeniu dwóch skryptów. Pierwszy odpowiada za wyświetlanie bannerów na forum, natomiast drugi odpowiada za losowe wyświetlanie danego elementu. Chciałbym aby jeden z bannerów z pierwszego skryptu po każdym odświeżeniu strony zmieniał się na inny banner dodany do listy skryptu losowego. Pomoże ktoś? :)

skrypt pierwszy

<table class="tborder" border="0" cellpadding="4" cellspacing="1">
<tbody><tr>
<td class="thead"><div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['usercpmisc']}.gif" id="reklama_img" class="expander" alt="[-]" title="[-]"
/></div><strong><center>test</center></strong></td>
</tr>
<tr id="reklama_e">
<td class="trow1"><center><table &nbsp;="" width="100%" border="0" cellpadding="3" cellspacing="0">

<tbody><tr>
<td width="50%"><center><a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/cichlidae_banner.png"></a></center></td>
<td width="50%"><center><a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/cichlidae_banner.png"></a></center></td>
</tr>

</tbody></table></center></td>
</tr>
</tbody></table>

oraz drugi - skrypt losowy

<script type="text/javascript">
// <![CDATA[
Array.prototype.random = function(limit)
{
    if (typeof limit == 'undefined' || limit < 0) limit = 1;
    else if (!limit) limit = this.length;
    for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++)
    {
        do { var index = Math.random(); } while (index == 1);
        index = Math.floor(index * n);
        target.push(source[index]);
        source[index] = source[--n];
    }
    return target;
}

document.write(new Array(
// Tu wpisz kolejne elementy:

'Tekst 1',
'Tekst 2',
'Tekst 3'

).random(3).join(''));

// ]]>
</script>
Nie wiem, czy dokładnie o to Ci chodziło, ale sprawdź:
<table class="tborder" border="0" cellpadding="4" cellspacing="1">
<tbody><tr>
<td class="thead"><div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['usercpmisc']}.gif" id="reklama_img" class="expander" alt="[-]" title="[-]"
/></div><strong><center>test</center></strong></td>
</tr>
<tr id="reklama_e">
<td class="trow1"><center><table &nbsp;="" width="100%" border="0" cellpadding="3" cellspacing="0">

<tbody><tr>
<td width="50%">
<center>
<script type="text/javascript">
// <![CDATA[
Array.prototype.random = function(limit)
{
    if (typeof limit == 'undefined' || limit < 0) limit = 1;
    else if (!limit) limit = this.length;
    for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++)
    {
        do { var index = Math.random(); } while (index == 1);
        index = Math.floor(index * n);
        target.push(source[index]);
        source[index] = source[--n];
    }
    return target;
}

document.write(new Array(
// Tu wpisz kolejne elementy:

'<a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/cichlidae_banner.png"></a>',
'Kolejny banner',
'I tak dalej'

).random(3).join(''));

// ]]>
</script>
</center>
</td>
<td width="50%"><center><a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/cichlidae_banner.png"></a></center></td>
</tr>

</tbody></table></center></td>
</tr>
</tbody></table>
Dzięki za pomoc :) Zmodyfikowałem jeszcze odrobinę i teraz działa jak ta lala.

Wrzucam dla potomnych gotowy kod, trzeba tylko pozmieniać adresy stron i obrazków i gotowe.

<table class="tborder" border="0" cellpadding="4" cellspacing="1">

<tbody><tr>

<td class="thead"><div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['usercpmisc']}.gif" id="reklama_img" class="expander" alt="[-]" title="[-]"
/></div><strong><center>Wspierają nas</center></strong></td>
</tr>
<tr id="reklama_e">
<td class="trow1"><center><table &nbsp;="" width="100%" border="0" cellpadding="3" cellspacing="0">

<tbody><tr>
<td width="50%"><center>

<script type="text/javascript">

// <![CDATA[

Array.prototype.random = function(limit)

{

if (typeof limit == 'undefined' || limit < 0) limit = 1;

else if (!limit) limit = this.length;

for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++)

{

do { var index = Math.random(); } while (index == 1);

index = Math.floor(index * n);

target.push(source[index]);

source[index] = source[--n];
}

return target;

}



document.write(new Array(

// Tu wpisz kolejne elementy:



'<a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/ads/1.PNG"></a>',

'<a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/ads/2.PNG"></a>',

'<a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/ads/3.PNG"></a>'



).random().join(''));



// ]]>

</script>

</center></td>

<td width="50%"><center><a href="http://cichlidae.pl/"><img src="http://cichlidae.pl/images/ads/1.PNG"></a></center></td>
</tr>

</tbody></table></center></td>
</tr>
</tbody></table>



Użytkownicy przeglądający ten wątek:

1 gości