This installation has finally been corrupted by spam. I have moved the forums to a fresh install of Vanilla. This phpbb installation should be used as reference only. Click here to go to the new forums.
 Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Faux Checkboxes

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.   printer-friendly view     Forum Index -> Javascript and CSS Projects
View previous topic :: View next topic  
Author Message
buggedcom
discussing the shortcomings of issac newton


Joined: 18 Oct 2002
Posts: 682
Location: working from home

PostPosted: Sun Apr 23, 2006 5:21 pm    Post subject: Faux Checkboxes Reply with quote

Code:
/**
 * Creates Custom Checkboxes. Should be compatible across all browsers.
 * @license LGPL
 * @created 12.04.2006
 * @author Oliver Lillie
 * @email publicmail -at- buggedcom -dot- co -dot- uk
 */
 fauxcheckbox = {
   
   checked_path:          'images/checkbox/on.gif',
   unchecked_path:       'images/checkbox/off.gif',
   ani_to_checked_path:    'images/checkbox/to_on.gif',
   ani_to_unchecked_path:    'images/checkbox/to_off.gif',
   
   toggle: function(element, force)
   {
      var $checkbox = $ref(element);
      var $img = $ref('_checkbox_'+element);
      if(typeof $img.dragging == 'undefined' || !$img.dragging)
      {
         force = typeof force != 'undefined' ? force : null;
         if (force === false || $img.src.substring($img.src.lastIndexOf("/")+1)=="on.gif" || $img.src.substring($img.src.lastIndexOf("_")+1)=="on.gif")
         {
            $img.src = this.ani_to_unchecked_path;
            $checkbox.value = false;
            setTimeout("$ref('"+$img.id+"').src = '"+this.unchecked_path+"';", 200);
         }
         else
         {
            $img.src = this.ani_to_checked_path;
            $checkbox.value = true;
            setTimeout("$ref('"+$img.id+"').src = '"+this.checked_path+"';", 200);
         }
      }
   },
   
   create: function(id, initstate, form)
   {
      var src = initstate ? this.checked_path : this.unchecked_path;
      var str = '<img id="_checkbox_'+id+'" onclick="fauxcheckbox.toggle(\''+id+'\');" src="'+src+'" width="18" height="18" /><input type="hidden" name="' + id + '" id="' + id + '" value="null" />';
      return str;
   }
};

_________________
~buggedcom Smile
If anyone would like to buy me anything for all my hard work, my Amazon wish list is here or you could donate into my paypal account publicmail_at_buggedcom.co.uk
Thanks Very Happy


Latest Projects 1 | 2 | 3
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.   printer-friendly view     Forum Index -> Javascript and CSS Projects All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
1.19069290161