SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    California
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image Rotating Script Problem...

    Hello, I'm having a slight problem with this image rotating script I have. I didn't create it myself, it was kiddied from another site that uses it (this is at my work, kiddied from an older site we have).


    The code gives an "object expected" error. Now i know why it's doing this, the function it's calling to isn't declared. When I try declaring the function it gives me different errors. I can't seem to fix this problem.

    The code is:
    Code:
    <script type="text/javascript">document.write(firstPicture());</script>
    		<script language="JavaScript" type="text/javascript">
    		var pictures = 5;
    		var dt = new Date();
    		var hr = dt.getSeconds();
    		var ra = hr % pictures;
    		var re = ++ra;
    		var msg="<img src=images/banner_roll/hp_"+re+".jpg>";
    document.write(msg);</script>
    The error comes from the firstPicture() code. The frustrating thing is that the code works fine - just that error. Our client is wanting that error gone (understandably)

    If someone could help me out it'd be much appreciated.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,499
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    firstPicture() does not exist

    best you specify what you are tying to do and we can start from scatch!

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    California
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've tried declaring firstPicture by making where it's called say "function firstPicture()" and get an error from that.

    I've also tried declaring it as a function in a different script with no luck.

    All i need really is to get rid of the error. If that means switching over to another script that's fine as well.

    The code is so old - we don't even know who wrote it. We think it might have been our old coder from years ago. Though it could have also been kiddied from some other site also.

    ps: the extent of my coding knowledge comes from a C++ course I took 3-4 years ago my senior year in high school. It was very very basic. I also am currently learning some Actionscript 2.0 for school. HTML write up i'm very experienced in, but that's a moot point. I also know a tiny bit of PHP. I may be using the wrong terms. I'm horrible at remembering stuff like that.

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,499
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok but what do you want to do?

    when, how oftet do you whant the images to rotate?

  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    California
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    on page load.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •