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

Views: 2910   Replies: 1  Answers: 1
Joined: Mar 07, 2012 12:06 AM
Location:  
pune
India  India
Asked: 55
Answered: 1
Attempted: 8

    <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.

 

Lucky


Joined: Nov 11, 2011 05:52 PM
Location:  
India 
Answered: 2696
Attempted: 3552
0

Put the script on the content page in ContentPlaceHolder

MVP ASP.Net

© 2013 www.aspforums.net All rights reserved. Powered by Excelasoft Solutions.  Excelasoft Solutions

Disclaimer: This site is started with intent to serve the ASP.Net Community by providing forums (question-answer) site where people can help each other. The content posted here is free for public and is the content of its poster. The site does not provide any warranties for the posted content. If you feel any content is violating any terms please contact.
Google+ | FaceBook | Glossary
Google