[thelist] Re: javascript browser/platform/css help needed

Marlene Bruce marlene at digitizethis.com
Tue Oct 29 10:33:06 CST 2002


Hi Karen,

Thanks for the help with the Javascript and the suggestion about the
style formatting. If it were CSS I'd keep each style definition on a
separate line (I'll consider doing the same here).

You'd think after 7 years I'd have gotten around to learning
Javascript by now...

Cheers,
Marlene

-----

>Hi Marlene,
>
>// modifying the first bit:
>var NS4 = (document.layers);
>var IE4 = (document.all);
>var ver4 = (NS4 || IE4);
>var IE5 = (IE4 && navigator.appVersion.indexOf("5.")!=-1);
>var isMac = (navigator.appVersion.indexOf("Mac") != -1);
>var isWin = (navigator.appVersion.indexOf("Win") != -1);
>
>var style_sheet=0;
>var font_1=7;
>var font_2=10;
>var font_3=11;
>var font_4=12;
>var font_5=16;
>var font_6=18;
>var modifier=0;
>
>// For Win Netscape 4, to serve the font sizes with a +1 modifier.
>if (NS4 && isWin) {
>      modifier = 1;
>}
>
>// For Mac IE 4 and Netscape 4, to serve the font sizes
>// with a +3 modifier.
>if (isMac && (IE4 || NS4)) {
>      modifier = 3;
>}
>
>// for anything other browsers you don't need to do anything.
>
>// write your styles - I've split this over a few more
>// lines here purely for clarity
>document.write('<style type="text/css">\n');
>document.write('p, body, td, ul, ol, li\n{');
>document.write('\nfont-family: Verdana, Arial, Geneva, sans-serif;');
>document.write('\nfont-size:');
>document.write(font_4 + modifier);
>document.write('px;\ncolor: #000000;\n}\n');
>document.write('</style>\n');
>
>hth :)
>Karen



More information about the thelist mailing list