C
czuvich
All,
I was wondering if it was possible to change a css class on a page load
(somehow). Basically, I am wanting to say this:
<div id="myclass" class="a javascriptfunction">
Is this possible? I want the javascript function to set the class name.
If so, could someone please post a snippet? If not.. here's my
scenario... perhaps there is a better alternative.
I have a checkbox that when checked it changes the stylesheet for a
dynamic popup effect.
function Swap(element)
{
if(document.getElementById(element).className == 'open')
{
document.getElementById(element).className= 'closed';
}
else
{
document.getElementById(element).className= 'open';
}
}
Me.ckbAdvanced.Attributes.Add("OnClick",
"JavaScript:Swap('advancedoptionsmenu');")
This works fine. However, I then click a submit button that does a
postback. Lo and behold, I lose my css class since I initialize it in
the html to 'closed' (automatically sets it to closed). I want to keep
my css class as 'open' during a postback. How can I accomplish this?
I was wondering if it was possible to change a css class on a page load
(somehow). Basically, I am wanting to say this:
<div id="myclass" class="a javascriptfunction">
Is this possible? I want the javascript function to set the class name.
If so, could someone please post a snippet? If not.. here's my
scenario... perhaps there is a better alternative.
I have a checkbox that when checked it changes the stylesheet for a
dynamic popup effect.
function Swap(element)
{
if(document.getElementById(element).className == 'open')
{
document.getElementById(element).className= 'closed';
}
else
{
document.getElementById(element).className= 'open';
}
}
Me.ckbAdvanced.Attributes.Add("OnClick",
"JavaScript:Swap('advancedoptionsmenu');")
This works fine. However, I then click a submit button that does a
postback. Lo and behold, I lose my css class since I initialize it in
the html to 'closed' (automatically sets it to closed). I want to keep
my css class as 'open' during a postback. How can I accomplish this?