PDA

Click to See Complete Forum and Search --> : document.write not working in NS


pnj
Mar 2nd, 2001, 01:48 PM
here is my code.
this works in IE and not in NS4.7.

<script language='JavaScript'>
<!--
var ns = (navigator.appName == 'Netscape');
var ie = (navigator.appName == 'Microsoft Internet Explorer');
//var disnavsize='';
var d = window.document;

if(ns) {disnavsize='10'};
if(ie) {disnavsize='9'};

document.write("<style type='text/css'>");

document.write('A.DisNav {color:#666666;font-weight: bold; font-size:' + disnavsize + 'px; text-decoration: none; font-family: Arial, helvetica;}');
document.write('A.DisNav:hover {color:#9ccc99;}');
document.write('</style>');
-->

</script>

<a class=DisNav href="#"><br>testing</a>


the style sheet gets ignored completly in NS

any suggestions?

thanks

Cander
Mar 2nd, 2001, 02:12 PM
I dont think that verion of netscape supported those CSS elements

pnj
Mar 2nd, 2001, 02:23 PM
it works if i don't use document.write but I need to change the size of the text depending on what browser the user has.

this works in both IE and NS execpt for the hover property isnt supported in NS

<style>
A.Test
{
BACKGROUND-COLOR: white;
COLOR: #cc6666;
FONT-FAMILY: Arial, 'MS Sans Serif', helvetica;
FONT-SIZE: 12px;
FONT-WEIGHT: bold;
LINE-HEIGHT: 11px;
}
A.Test:hover
{
color:#999999;
}
</style>
<a class=Test href="#"><br>testing</a>

but like I said, i need to use document.write