View Full Version : script works on FF6, but not 3.622

09-13-2011, 09:45 PM
I just discovered one of my scripts doesn't work quite right on an older version of Firefox(3.622). It does when I reload the page, but not automatically on initial load Any thoughts on what to change? Here's what I have...

<script type="text/javascript" src="author_find.js"></script>

<img src=/storage/image.gif onload="javascript:doit();" />
<div id="author"></div>

Here is the script it is referencing:

function doit() {


var theURL = null;

var spans = document.getElementsByTagName("span");
for ( var s = 0; s < spans.length; s++ )
// searching through spans for the class name:
var span = spans[s];
if ( span.className.indexOf("posted-by") >= 0 )
var useit = span.getElementsByTagName("a")[0];
theURL = useit.href;
break; // just the one
if ( theURL == null )
// alert("failed!");
} else {

var parts = theURL.split('/');
var result = parts[parts.length-1];

if (result == "somebodysname") {
var txt=document.getElementById("author");
txt.innerHTML="<table width=100px border=0 cellpadding=0 cellspacing=0 bgcolor=#ffffff><tr><td>content1</td></tr></table>";

} else if (result == "anothername") {

var txt=document.getElementById("author");



}else { }

Logic Ali
09-13-2011, 09:58 PM
Do you get any error messages in the console when it fails?

Images load asynchronously, so triggering an action based on the loading of an image could give inconsistent results.

09-13-2011, 11:22 PM
No error report comes up. It is on a computer without firebug though. I'm not sure that program works on the older browser.

The asynchronous loading isn't an issue, just so long as the script runs when that image loads.
(I can't put it in the header, because I'm placing scripts on a site that is generated by a third-party blog management programing.)

Would an older browser go to a cached version of the image instead of loading it and cause a problem though?

09-13-2011, 11:44 PM
shouldn't this:
img src=/storage/image.gif

be this:
img src="/storage/image.gif" ?

and if you suspect it is getting stuck in the cache, you can add a cache busting parameter

Logic Ali
09-14-2011, 01:41 AM
No error report comes up. It is on a computer without firebug though. I'm not sure that program works on the older browser.
There's still the built-in error console: Under 'Tools' or Ctrl + Alt + J.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum