Results 1 to 3 of 3

Thread: Font-Family Pulldown: NEED COOKIE PLEASE

  1. #1
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Font-Family Pulldown: NEED COOKIE PLEASE

    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:
    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 -->
    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:
    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;
    }
    
    
    //--><!]]>

    Mike E.
    Last edited by mrmesells; 12-24-2006 at 03:16 AM.

  2. #2
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Anybody Here???????

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Javascript isn't really my thing, but seems quite easy, really.
    Just use setCookie() (I think that's the function, anyway) when they choose one.
    Then it should be accessible from document.cookie later.
    I'm sure that there are tons of references around for this.
    Sorry I'm not more help.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •