You are here: irt.org | BBS | JS files [This BBS is closed]
Posted by John Beardsworth on August 01, 1998 at 07:24:59:
I'm experimenting with moving my site's JavaScript into external js files, but I'm stuck on calling up a function - I wonder if its obvious to someone.
The js file (at bottom of this posting) has 3 functions:
1) browser_ok checks the browser type
2) util_mod uses browser_ok, then writes the modified date when called in the document's body. This works OK.
3) util_msover should check the browser type when it is called by buttons' onMouseOver event.
util_msover is failing at the line browser_ok (); - in IE4 it says "function expected" and NN4 "broser_ok is not a function".
Does anyone see the answer?
Thanks
John
function browser_ok ()
{browser_name = navigator.appName;
browser_version = parseFloat (navigator.appVersion);
if (browser_name == "Netscape" && browser_version >= 3.0)
{ browser_ok = 'true'; }
else if (browser_name == "Microsoft Internet Explorer"
&& browser_version >= 4.0) { browser_ok = 'true'; }
else { browser_ok = 'false'; }}
function util_mod ()
{browser_ok ();
if (browser_ok == 'true');
var_mo = document.lastModified.substring (0,3);
var_dt = document.lastModified.substring (3,6);
var_yr = document.lastModified.substring (6,8);
var_modified = var_dt + var_mo + var_yr ;
document.write ('<center><font size="1">Updated <br>'+var_modified );}
function util_msover (img,ref)
{browser_ok ();
if (browser_ok == 'true');
{document.images[img].src = ref; }};
Follow-ups: