Results 1 to 2 of 2

Thread: Text and Image Crawler / replace interHTML not working in FF

  1. #1
    Join Date
    Dec 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Text and Image Crawler / replace interHTML not working in FF

    Script: Text and Image Crawler
    http://www.dynamicdrive.com/dynamici...wler/index.htm

    When I replace the text the crawler shows it's appending it to the original text in FF. It works correctly in IE...

    I put a quick demo of the issue up at:
    http://lassoingmonkeys.com/tickerTest3.html

    In the demo the bold text "Replacement text" is what was I set the innerHTML of the crawl to.

    Anyone have any ideas on this one?

    Thanks,
    Brandon

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,957
    Thanks
    43
    Thanked 3,195 Times in 3,157 Posts
    Blog Entries
    12

    Default

    Well, you've done some strange things with my script. It already has a method for initialization that eliminates the need for an onload event. But you have added one anyway. The innerHTML property is non-standard and can cause problems. Crawler avoids its use. Also, IE 7 and less (and IE 8 in quirks mode - what your page is evaluated as) aren't playing with a full deck here since you've placed your crawler in a table. They can't init until after the table is completely parsed, so they add its initialization to a queue that has listened for document load to know when it's OK to proceed. It's a little surprising the init fires at all in those browsers because by the time the init is called, load has technically passed, but I did write things so that a crawler could be initialized at any time. So instead this has somehow simply reversed the execution order of:

    Code:
    marqueeInit({
    	uniqueid: 'mycrawler2',
    	style: {
    		'padding': '5px',
    		'width': '100%',
    		'background': 'yellow',
    		'border': '1px solid #FF0000'
    	},
    	inc: 8, //speed - pixel increment for each iteration of this marquee's movement
    	mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
    	moveatleast: 4,
    	neutral: 150,
    	savedirection: true
    });
    and:

    Code:
    document.getElementById("testTicker").innerHTML = "<b>Replacement text</b>";
    There is a good chance that if you reverse them, you will get what you want. But it is also possible that may give rise to other unexpected behavior in Firefox and/or IE, not to mention other browsers. Basically what you are attempting is to impose archaic markup and script techniques on an advanced script. It can work out, but there is no guarantee. But I'd give this a try, change:

    Code:
    <script type="text/javascript">
    function loadit(){
    
    marqueeInit({
    	uniqueid: 'mycrawler2',
    	style: {
    		'padding': '5px',
    		'width': '100%',
    		'background': 'yellow',
    		'border': '1px solid #FF0000'
    	},
    	inc: 8, //speed - pixel increment for each iteration of this marquee's movement
    	mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
    	moveatleast: 4,
    	neutral: 150,
    	savedirection: true
    });
    
    //alert("1 - "+document.getElementById("testTicker").innerHTML);
    document.getElementById("testTicker").innerHTML = "<b>Replacement text</b>";
    //alert("2 - "+document.getElementById("testTicker").innerHTML);
    
    }
    </script>
    to:

    Code:
    <script type="text/javascript">
    function loadit(){
    
    document.getElementById("testTicker").innerHTML = "<b>Replacement text</b>";
    
    marqueeInit({
    	uniqueid: 'mycrawler2',
    	style: {
    		'padding': '5px',
    		'width': '100%',
    		'background': 'yellow',
    		'border': '1px solid #FF0000'
    	},
    	inc: 8, //speed - pixel increment for each iteration of this marquee's movement
    	mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
    	moveatleast: 4,
    	neutral: 150,
    	savedirection: true
    });
    
    }
    </script>
    - John
    ________________________

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

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
  •