Featured Posts

Web Presense Solution I've officially started up my independent web development side-business. I am hoping to bring quite a few small businesses into the present with a simple, cost-effective package that provides them with...

Readmore

MS SQL date / time conversion I often find myself turning to MSDN to get the possible conversion options on MS SQL's date data type, so I finally became un-lazy and created a little script to use in the future to quickly list all possibilities...

Readmore

jQuery Delay Happy Note: I was contacted by the jQuery team and my code is being added to the core functionality; that really made my day!  You will want to remove the current code from your site if you plan on upgrading...

Readmore

ASP Search Stemmer Class The original stemmer class was developed by Martin Porter to bring words back to their word stems. For example "abilities" would stem to "able", "smelling" to "smell", "I'm awesome" to "damn straight",...

Readmore

  • Prev
  • Next

The moment the web has been waiting for!

Posted on : 30-06-2009 | By : chelfers | In : General

0

It has taken years of dedication, countless hours of arguing, and tens of friends begging, pleading, please Clint do some sort of social networking! Well dammit, the time has come! I give you Me!

And I don't want any crap for the theme I chose; I made it a goal to find something that could define who I am, a theme that would tell the world, "Hey, this guy is hip, this guy is cheeky, this guy spells a lot of words wrong and uses a ton of commas". Well after 20 pages of searching I didn't find anything remotely interesting, so a big ass bird saying follow me was as much of a sign as any after a mind numbing ten minutes of previewing. I guess that means I better start using twitter now, sigh.

I will try and post up my happenings in the web development and wine worlds and with any luck have at least one returning reader each month (lucky you).

jQuery and Forms

Posted on : 30-06-2009 | By : chelfers | In : JQuery, Javascript, Javascript Libraries, Web

0

On my latest searches for various ways jQuery interacts with the DOM, and more importantly forms for my recent project I've found that various sites could answer some of my questions but most focused on single form elements and not much more.

jQuery can access elements in quite a few different ways, such as by tag name and css class; I often find myself selecting elements based on ID more than anything. A function many people are probably familiar with is the $() function; aside from just looking completely awesome it is a huge time saver in terms of typing.

What I consider to be the "original" $ function was simply a quick shortcut for typing out document.getElementById(element); of course now it has grown far beyond that and many Javascript libraries use it as an entry point to their objects.

//this is not the jQuery $() - simple syntax is $('element') and from there you can //manipulate it how you like $('element').value, $('element').innerHTML, //$('element').style.cssText, etc - this function only accepts IDs function $() {    var elements = new Array();      for (var x = 0; x < arguments.length; x++) {           var element = arguments[x];                if ('string' == typeof element){ element = document.getElementById(element); }                if (arguments.length == 1){return element};           elements.push(element);      }      return elements; }

A simple and beautiful ( especially if you don't want to run the jQuery library ) function that will take one or many IDs and pass them back as a single result or an array. But anyways, enough with the jib-jab on with the examples!

Text Box
<input type="text" id="text_1" class="HappyCow" value="" /> <input type="text" id="text_2" class="HappyCow" value="" /> <input type="text" id="text_3" class="MadCow" value="" />
//set a value for the given text box $('#text_1').val('test'); //set a value for the given text box - traditional method $('#text_1')[0].value = 'test'; //get a value for the given text box var test = $('#text_1').val(); //get a value for the given text box - traditional method var test = $('#text_1')[0].value; //set a value for every textbox with the HappyCow class $('.HappyCow').val('Moooo');
Check / Radio
<input type="radio" id="radio_1" name="group_1" class="HappyCow" value="1" /> <input type="radio" id="radio_1" name="group_1" class="HappyCow" value="1" /> <input type="radio" id="radio_1" name="group_1" class="HappyCow" value="1" />
//is the element checked? - result: 1 or 0 var test = $('#radio_1:checked').length; //is the element checked? - result: true or false var test = $('#radio_1').is(':checked'); //is the element checked? - result: true of false var test = $('#radio_1')[0].checked; //check the element $('#radio_1').attr('checked','checked'); //what is the value of the checked option in the group? var test = $('.HappyCow:checked').val()
Selectbox
<select id="select_1">   <option value="1">one</option>   <option value="2">two</option>   <option value="3">three</option> </select>
//select the option that matches the value provided $('#select_1 option[value=1]').attr('selected', true); //get the selectedIndex - note the first element is 1 var test = $('#select_1 option[selected]').val(); //how about something even easier? var test - $('#select_1').val(); //get the selectedIndex - traditional method, first element is 0 var test = $('#select_1')[0].selectedIndex;

Hope this helps someone out!

Evony.com

Posted on : 30-06-2009 | By : chelfers | In : Games, Web

0

Only 2 days 11 hours left before the barber shop is complete

With my life being a tab bit busier now I have almost reduced myself to zero-game time. Thankfully browser games are still a big hit with the gaming community and require only a few minutes each day to play and actually be successful.

I believe I have finally reached a point where I can stop torturing myself with OGame and move on to another browser game called Evony. I'm into my second day with it now and it looks like it could be fairly addictive, but with some large turn-offs like the interface and global chat ( which you have to "pay" to use ) full of preteen gibberish.

Not sure how long I will last, but being positive about it, I have some more ideas thanks to Evony that I can use in a collaborative project sm4k and I have started planning.

If you want to drop me a line in game I'm on server 22 noobing it up as clownshoes.