Display random image when page loads without utilizing onload in the body tag

后端 未结 9 742
逝去的感伤
逝去的感伤 2021-01-06 06:14

I\'m trying to create a fairly simple piece of JavaScript that displays a random image from an array each time the page loads. I need to figure out a way to get this runnin

9条回答
  •  北荒
    北荒 (楼主)
    2021-01-06 06:54

    Your answer can be found at glados.cc/myfaucet.
    there is a script for download there which has the code you are looking for here is a brief synopsis: create file config.php and put this inside:

    ');
    
    $textAds = array('

    YourURL

    ', '

    Get your own site here

    '); $bannerAds = array(' '); ?>

    Then, on the page you are serving, say, index.php to display your random links or images or text simply put:

    
    

    Of course, you can create as many $xxxAds arrays and name them whatever you want, and you can fill in the arrays with whatever html or jscript to be displayed, as well as an unlimited number per array, in csv format you can also create as many new "getAd" functions with different names so that you can have multiple unique iframe ads being displayed on one page

提交回复
热议问题