HighDots Forums  

Need Cookie: Font-family Selector

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Need Cookie: Font-family Selector in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
m2
 
Posts: n/a

Default Need Cookie: Font-family Selector - 12-23-2006 , 07:00 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??????

You can see it in action here: http://doctoreast.com/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:
http://doctoreast.com/scripts/add-css.txt

MikeE



Reply With Quote
  #2  
Old   
m2
 
Posts: n/a

Default Re: Need Cookie: Font-family Selector - 12-23-2006 , 07:12 PM






Heres the pulldown:

Code:
<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 -->



Heres the js file:
Code:
// 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; } //--><!]]>



Reply With Quote
  #3  
Old   
m2
 
Posts: n/a

Default Re: Need Cookie: Font-family Selector - 12-23-2006 , 09:19 PM



View it In Action: HERE

http://doctoreast.freepgs.com/tools/freestuff.html



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.