Click to See Complete Forum and Search --> : javascript wont work


marshy28
02-09-2003, 06:17 AM
Can anybody tell me why this simple piece of javascript wont work its doing my head in it just says the url in wrong or missing.....Thanks Marshy

Its on http://www.barrys-drivingschool.fsnet.co.uk/contents.htm

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
var url="http://www.barrys-drivingschool.co.uk";
var title="Barrys School of Motoring";
document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Add our site to your favorites!'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('"> Addto Favorites</a>');
}
else {
var msg = "Bookmark us";
if(navigator.appName == "Netscape") msg += " press (CTRL-D) now!";
document.write(msg);
}

// End -->
</script>

linnie
02-09-2003, 10:44 AM
In IE6, at least, it works fine. Since I already have a driver's license, I don't need your ad. :p

Lin

marshy28
02-09-2003, 10:56 AM
So how come it wont work in IE5 then?
Do I need to change it a little?
Also can i do this without using javascript

Cheers
Phil

linnie
02-09-2003, 11:04 AM
Without javascript? ...no. IE5? ...sorry, I don't have that browser to test with. Perhaps some other kind soul on this site will help you with that. :)

Dan Drillich
02-09-2003, 11:33 AM
It works for me with IE6 only after changing 'java script' to javascript -



<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
var url="http://www.barrys-drivingschool.co.uk";
var title="Barrys School of Motoring";
document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Add our site to your favorites!'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('"> Addto Favorites</a>');
}
else {
var msg = "Bookmark us";
if(navigator.appName == "Netscape") msg += " press (CTRL-D) now!";
document.write(msg);
}

// End -->
</script>


<br>
<br>

<A HREF="javascript:window.external.AddFavorite(url,title);" > Add to Favorites </a>

Dan Drillich
02-09-2003, 11:37 AM
Strange - the space was again introduced when posting the code :mad:

marshy28
02-09-2003, 11:43 AM
Thanks Dan I will try losing the space in java script