Results 1 to 9 of 9

Thread: Script in table overrides a preloaded one(?)

  1. #1
    Join Date
    Sep 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Script in table overrides a preloaded one [solved]

    Hi! :-)

    DD Fade-in slideshow
    http://www.dynamicdrive.com/dynamici...nslideshow.htm

    I just made a menu involving two scripts; one is supposed to exchange menu buttons while the user hovers over the link with the mouse (this one is generated by Adobe ImageReady), the other one is the great DD Fade-in slideshow which I like very much because it works so neatly. :-)

    I got the impression that on the page in question the slideshow overrides the ONLOAD command in the body tag. Is that true? How could I possibly avoid this?

    Thanks for helping! :-)

    Cheers!
    Last edited by mkr; 09-01-2005 at 04:16 PM. Reason: Problem solved

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    if (ie4||dom)
    window.onload+=startit
    else
    setInterval("rotateimage()",pause)
    Just add in the + sign, and it'll stop overwriting it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Sep 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face

    Thanks Twey for the quick reply, but I'm afraid this didnt work at all. Where there is a + or not doesnt make a difference.

    Another funny thing I noticed (just for the details):
    - In both IE and Firefox I cant get those two scripts to work at the same time.
    - In Opera, both scripts work fine (although the Crossfader doesnt really crossfade, it shows the next image instantly after the set delay.)

    *puzzled*

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Well, it's not the onload that's being overridden, then.
    Opera doesn't support transparency, hence the script not working as it should.
    There's nothing else I can see that would interfere between the two scripts. Upload the latest version (with the plus) and let me have a look.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Sep 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Try changing
    Code:
    function changeImages() {
    	if (document.images && (preloadFlag == true)) {
    		for (var i=0; i<changeImages.arguments.length; i+=2) {
    			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    		}
    	}
    }
    to
    Code:
    function changeImages() {
    	if (document.images && (preloadFlag == true)) {
    		for (var j=0; j<changeImages.arguments.length; j+=2) {
    			document[changeImages.arguments[j]].src = changeImages.arguments[j+1];
    		}
    	}
    }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Changing the name of a local variable should not make any difference and window.onload+= is unconventional at best, probably unreliable. I'd have changed:
    Code:
    if (ie4||dom)
    window.onload=startit
    else
    setInterval("rotateimage()",pause)
    to:
    Code:
    if (ie4||dom){
    if ( typeof window.addEventListener != "undefined" )
        window.addEventListener( "load", startit, false );
    else if ( typeof window.attachEvent != "undefined" ) {
        window.attachEvent( "onload", startit );
    }
    else {
        if ( window.onload != null ) {
            var oldOnload = window.onload;
            window.onload = function ( e ) {
                oldOnload( e );
                startit();
            };
        }
        else
            window.onload = startit;
    }
    }
    else
    setInterval("rotateimage()",pause)
    and be done with it. Works here.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Sep 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Solved

    Terrific! This works! Thanks a bunch!

    Thanks guys, thou shalt be credited!

  9. #9
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    I dont know if this would help any but when I do image rollovers I just use the DOM and it has never conflicted with any other scripts I happen to have running:

    Code:
    <a href="photos.htm" onmouseover="photosbutton.src='photobuttonover.gif';" onmouseout="photobutton.src='photobuttonout.gif';"><img border="0" src="photobuttonout.gif" name="photobutton"></a>
    And then you can always use CSS to position the fading effect, or tables if you want.

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
  •