Last Reply on Mar 07, 2012 08:26 AM By Mudassar
Posted on Mar 07, 2012 08:25 AM

    <script type="text/javascript" language="javascript">
        window.onload = function () {
            var rotator = document.getElementById("rotator");
            var images = rotator.getElementsByTagName("img");
            for (var i = 0; i < images.length; i++) {
                images[i].style.display = "none";
            }
            images[0].style.display = "block";

            var counter = 0;
            setInterval(function () {
                for (var i = 0; i < images.length; i++) {
                    images[i].style.display = "none";
                }
                images[counter].style.display = "block";
                counter++;
                if (counter == images.length) {
                    counter = 0;
                }
            }, 3000);
        };
    </script>

    <td align="left" style="width:564px;height:235px; padding-bottom:20px;">
    <div id="rotator">
        <img src="images/banner.gif"  style="width:564px;height:235px;"/>
        <img src="images/de-ionizedwate.r1jpg.jpg"style="width:564px;height:235px;" />
        <img src="images/demineralizedwater.jpg" style="width:564px;height:235px;"/><img
            src="images/1exide.png" /><img src="images/1honda.png" /><img src="images/1honda1.png" />
            </div>
    </td>

 

Im using this code as you sugested i have written the script in master page and other thing in another page

i want to display the image only in 1 specific page but it is not working it is giving error if i click on another page

and the error is below

Microsoft JScript runtime error: Unable to get value of the property 'getElementsByTagName': object is null or undefined.

please suggest me something.

 

Posted on Mar 07, 2012 08:26 AM

Put the script on the content page in ContentPlaceHolder