mrmesells
12-23-2006, 11:55 PM
Hi,
Can someone please help me with a cookie for a
javascript css class styler. The script allows addition
of any js/css style, and works well, but needs a cookie.
What I'm trying to do is set the font-family selector
on the .wrap div. Please help??????
The pulldown selector is here:
<div class="font-family_black">
<form action="#" id="familyform">
<select class="pullfamily" onchange="getStyleClass('wrap').style.fontFamily = this.options[this.selectedIndex].value;">
<option value="Verdana, Arial, Helvetica" selected="selected">Select Font Family</option>
<option value="Times, serif">Times</option>
<option value="Arial, Helvetica, sans-serif">Arial</option>
<option value="Georgia, Times, serif">Georgia</option>
<option value="Geneva, Arial, Helvetica, sans-serif">Geneva</option>
<option value="Helvetica, Arial, Geneva">Helvetica</option>
<option value="Verdana, Arial, Helvetica">Verdana</option>
<option value="Courier, monospace">Courier</option>
<option value="monospace, courier">Monospace</option>
</select>
</form>
</div>
<!-- close font_family -->
Site is cranky today, possibly see it in action:
http://doctoreast.freepgs.com/tools/freestuff.html
The home page is using php div name switcher to do the same thing, if interested.
The add-css.js file is here:
// JavaScript Document
// From http://www.faqts.com/knowledge_base/view.phtml/aid/2147/fid/128
// PLEASE COOKIE THIS? *NEEDS TO TRACK MULTIPLE CLASSNAMES AND CHANGES
// JAVASCRIPT CSS STYLES FOR ANY CLASSNAME
// ** LINK BELOW: LIST OF JAVASCRIPT CSS STYLES
// http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html
<!--//--><![CDATA[//><!--
// DID NOT ORIGINALLY WORK WITH ALTERNATE STYLESHEETS UNLESS YOU PUT
// BLAND INTERNAL CSS TAGS ABOVE ALL OTHER CSS FILE LINK REFERENCES:
// <style type="text/css">
// body {font-size:inherit;}
// .wrap {font=size:inherit;}
// </style>
function getStyleClass (className) {
for (var s = 0; s < document.styleSheets.length; s++)
{
if(document.styleSheets[s].rules)
{
for (var r = 0; r < document.styleSheets[s].rules.length; r++)
{
if (document.styleSheets[s].rules[r].selectorText == '.' + className)
{
return document.styleSheets[s].rules[r];
}
}
}
else if(document.styleSheets[s].cssRules)
{
for (var r = 0; r < document.styleSheets[s].cssRules.length; r++)
{
if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
return document.styleSheets[s].cssRules[r];
}
}
}
return null;
}
//--><!]]>
Mike E.
Can someone please help me with a cookie for a
javascript css class styler. The script allows addition
of any js/css style, and works well, but needs a cookie.
What I'm trying to do is set the font-family selector
on the .wrap div. Please help??????
The pulldown selector is here:
<div class="font-family_black">
<form action="#" id="familyform">
<select class="pullfamily" onchange="getStyleClass('wrap').style.fontFamily = this.options[this.selectedIndex].value;">
<option value="Verdana, Arial, Helvetica" selected="selected">Select Font Family</option>
<option value="Times, serif">Times</option>
<option value="Arial, Helvetica, sans-serif">Arial</option>
<option value="Georgia, Times, serif">Georgia</option>
<option value="Geneva, Arial, Helvetica, sans-serif">Geneva</option>
<option value="Helvetica, Arial, Geneva">Helvetica</option>
<option value="Verdana, Arial, Helvetica">Verdana</option>
<option value="Courier, monospace">Courier</option>
<option value="monospace, courier">Monospace</option>
</select>
</form>
</div>
<!-- close font_family -->
Site is cranky today, possibly see it in action:
http://doctoreast.freepgs.com/tools/freestuff.html
The home page is using php div name switcher to do the same thing, if interested.
The add-css.js file is here:
// JavaScript Document
// From http://www.faqts.com/knowledge_base/view.phtml/aid/2147/fid/128
// PLEASE COOKIE THIS? *NEEDS TO TRACK MULTIPLE CLASSNAMES AND CHANGES
// JAVASCRIPT CSS STYLES FOR ANY CLASSNAME
// ** LINK BELOW: LIST OF JAVASCRIPT CSS STYLES
// http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html
<!--//--><![CDATA[//><!--
// DID NOT ORIGINALLY WORK WITH ALTERNATE STYLESHEETS UNLESS YOU PUT
// BLAND INTERNAL CSS TAGS ABOVE ALL OTHER CSS FILE LINK REFERENCES:
// <style type="text/css">
// body {font-size:inherit;}
// .wrap {font=size:inherit;}
// </style>
function getStyleClass (className) {
for (var s = 0; s < document.styleSheets.length; s++)
{
if(document.styleSheets[s].rules)
{
for (var r = 0; r < document.styleSheets[s].rules.length; r++)
{
if (document.styleSheets[s].rules[r].selectorText == '.' + className)
{
return document.styleSheets[s].rules[r];
}
}
}
else if(document.styleSheets[s].cssRules)
{
for (var r = 0; r < document.styleSheets[s].cssRules.length; r++)
{
if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
return document.styleSheets[s].cssRules[r];
}
}
}
return null;
}
//--><!]]>
Mike E.