I have found a javascript that displays random banners. The code for this is in a seperate file which I include on my main page.

<? include "banners.php"; ?>

The javascript requires the body onload tag to get the javascript function kickstarted and rotate however becuase the javascript code in this include file it is not working.

Any ideas? I have never experienced this before.

Many Thanks
Adrian

    Can't you just add the javscript function to you page's <body> tag??

    <body onLoad="javascript:functionName()">

      1. Stop using short tags <?, use <?php instead

      2. Where are you including that file? Does it contain the full js surrounded by <script> tags?

      3. Personally I would have it as a js file and just link it in the head so that the js function is available onLoad

        What I will do is stick everything in an external js file and link to it from the head and see if this solves my problem. Some it is in a .js file and some of the code is in the <?php include file.

        Will let you know how I get on.

          Write a Reply...