Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    114

    Helpful JavaScript for Web development

    JavaScript codes for Web DEV

    Colours-on-Page Displaying with MooTools

    When users click a specified button, this JavaScript code example will get colours of all HTML elements with the predefined color attributes then fill those colours into many tiny rectangles. The auth... detail at JavaScriptBank.com - 2.000+ free JavaScript codes


    How to setup

    Step 1: Place CSS below in your HEAD section
    CSS
    Code:
    <style type="text/css">
    /*
         This script downloaded from www.JavaScriptBank.com
         Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
    */
    
    .dcolor  {
      height:40px;
    }
    
    .dtext {
      }
    
    .dwrapper {
      width:100px;
      float:left;
      padding:10px;
      margin:0 20px 20px 0;
      border:1px solid #ccc;
    }
    </style>
    Step 2: Copy & Paste JavaScript code below in your HEAD section
    JavaScript
    Code:
    <script type="text/javascript" src="/javascript/mootools.js"></script>
    <script type="text/javascript">
    // Created by: David Walsh | http://eriwen.com/css/color-palette-with-css-and-moo/
    // This script downloaded from www.JavaScriptBank.com
    
    //once the dom is ready
    window.addEvent('domready', function() {
    
    	//do it!
    	$('get-colors').addEvent('click', function() {
    		//starting the colors array
    		var colors = [];
    		var disallows = ['transparent'];
    
    		//for every element
    		$$('*').each(function(el) {
    			//record colors!
    			colors.include(el.getStyle('color'));
    			colors.include(el.getStyle('background-color'));
    			el.getStyle('border-color').split(' ').each(function(c) {
    				colors.include(c);
    			});
    		});
    
    		//sort the colors
    		colors.sort();
    
    		//empty wrapper
    		$('colors-wrapper').empty();
    
    		//for every color...
    		colors.each(function(val,i) {
    
    			//if it's good
    			if(!disallows.contains(val))
    			{
    
    				//create wrapper div
    				var wrapper = new Element('div', {
    					'class':'dwrapper'
    				});
    
    				//create color div, inject
    				var colorer = new Element('div', {
    					'class':'dcolor',
    					'style': 'background:' + val
    				});
    				colorer.inject(wrapper);
    
    				//alert(val);
    
    				//create text div, inject
    				var texter = new Element('div', {
    					'class':'dtext',
    					'text':val
    				});
    				texter.inject(wrapper);
    
    				//inject wrapper
    				wrapper.inject($('colors-wrapper'));
    			}
    		});
    	});
    });
    </script>
    Step 3: Copy & Paste HTML code below in your BODY section
    HTML
    Code:
    <!--
    /*
         This script downloaded from www.JavaScriptBank.com
         Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
    */
    -->
    <input type="button" id="get-colors" value="Get Colors" class="button">
    <br><br><br>
    <div id="colors-wrapper"></div>
    
    <br clear="all">
    
    <div style="text-align: left; width: 70%;">
    <p>
    Ma quande lingues coalesce. <span style="color: #279F37;">Li nov lingua franca va esser</span> plu simplic e regulari. Lorem ipsum dolor sit amet, <span style="color: #9F6827;">consectetuer adipiscing elit, sed diam nonummy</span> nibh euismod tincidunt ut <span style="color: #BFB00B;">laoreet dolore magna aliquam erat volutpat</span>.</p>
    
    </div>
    Step 4: downloads
    Files
    mootools.js






    Javascript Music Player - Random Text Generator - Floating Image Script
    Quote Originally Posted by Copyright
    The Site may provide, or third parties may provide, links to non-JavaScriptBank.com Internet World Wide Web sites or resources. Because JavaScriptBank.com has no control over such sites and resources, you acknowledge and agree that JavaScriptBank.com is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that JavaScriptBank.com shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.

  2. #2
    Junior Member
    Join Date
    May 2011
    Posts
    21
    Yeah i agree with you and i accept that is a really helpful post about JavaScript.

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    11
    Seems be interested if use at proper places of a website. I have visited the javascript bank link. Useful javascript resources are there. Thanks a lot.

  4. #4
    Senior Member
    Join Date
    Jun 2011
    Posts
    280
    Thanks for the information provided.

  5. #5
    Senior Member schwa's Avatar
    Join Date
    Mar 2011
    Location
    Chengdu, Sichuan, China
    Posts
    427
    That is pretty informative! I think it is pretty useful to do so!
    My name is Linda Chow, I am running a small online clothing store where you can find and shop sweet Lolita dress, Gothic Lolita dress and many other lolita accessories | My New Store: Cheap Latex Clothing

Posting Permissions

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

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.