G'day

Below - illustrates a method for overwriting global stylesheet attributes
dynamically.

--> document.styleSheets[0].addRule("div.mayhide","visibility:hidden")

Not sure if Netscape supports this, but the syntax is more correct than your
code.

Copy and paste the following into a new html document to see it in action...

---------
<begin cut>
---------

<html>
<head>
        <title>Untitled</title>
</head>

<style>
div.mayhide { visibility : visible; }
</style>

<script language="JavaScript">
        isTrue = false;
        function tognhide() {
                if (isTrue == false) {
                        
document.styleSheets[0].addRule("div.mayhide","visibility:hidden")
                        isTrue = true;
                } else {
                        
document.styleSheets[0].addRule("div.mayhide","visibility:visible")
                        isTrue = false;
                }
        }
</script>

<body>

<A href="#" onClick='javascript:tognhide();return false'>[-]</A>

<div class="mayhide">
text being affected by the mayhide class
</div>

text not affected

<div class="mayhide">
more text being affected by the mayhide class
</div>

</body>
</html>


---------
<end cut>
---------


James Head
Cortexebusiness.com.au





-----Original Message-----
From:
Sent: Wednesday, June 20, 2001 1:56 PM
Subject:


Robert,
Thanks for your reply.
I did do this, and it works, but I would really
like the external style sheet to automatically
affect all DynLayers, which it does do in IE
but not in Netscape (so that the <span> is not
necessary). This is the true workaround
I am seeking. Do you know of one?

Thanks again,
Jonah

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Robert
Rainwater
Sent: Tuesday, June 19, 2001 8:30 PM
To: Jonah
Subject: Re: [Dynapi-Help] css



The line:

<link rel="stylesheet" type="text/css" href="testStyle.css">

should be placed in the head of the document, not in the text of a
layer.

Then try something like:
myLayer.setHTML('<span class="someclass">text</span>')

--
Robert Rainwater


On 6/19/2001, 4:11:30 PM EST, Jonah wrote about "[Dynapi-Help] css":

> I am trying to use a style sheet within a DynLayer, and have tried:
>         myLayer.setHTML('<link rel="stylesheet" type="text/css"
> href="testStyle.css">' + someText);
> This works in IE but in Netscape actually prevents the display of all
> content in the layer.
> Anyone know a way to make this work cross-browser?

> Thanks,
> Jonah


> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to