This script allows you to use HTML5 tags (nav, header, footer, etc) in Internet Explorer 7 and 8.
To use it put this code in your page:
<!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
This script allows you to use HTML5 tags (nav, header, footer, etc) in Internet Explorer 7 and 8.
To use it put this code in your page:
<!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
To prevent text selection of any element use:
in Firefox, Opera and Webkit based browsers (Chrome, Safari, etc) this can be achieved by setting a CSS property.
-webkit-user-select:none; -moz-user-select:none; -o-user-select: none; user-select: none;
user-select is part of the CSS3 standard.
For IE < 9 we have two options:
Using javascript:
onselectstart="return false;"
and using the HTML attribute
unselectable="on"
Simple Ternary Search Tree Implementation in Ruby.
Currently supports:
git clone at: http://github.com/giancarlo/algorithms.git
The jquery.validate plugin allows us to define our own custom validation methods and messages like this:
$.validator.addMethod("equal_to", function(value, element, params) {
return value == condition;
}, message);
The interesting thing here is that message can be a function. We have complete access to the value, element and parameters of the input validation method.
Assuming our HTML is this:
<input type="text" equal_to="obj_id" />
Our equal_to method can be written like this:
var message = function(value, element, params) {
var expected = document.getElementById(params).value;
return value + " is not equal to " + expected;
}
This feature is useful when trying to implement validation methods, like greater_than_element or greater_date, that need additional information to generate their validation messages.
This is my new script. An image carousel/slideshow made in Javascript (no frameworks, HTML5 browsers).
It uses the new figure, figcaption HTML5 tags, and css3 opacity, transition, text-shadow and border-radius.
Demo and Code
Documentation
GitHub Development Page
The script was tested in Chrome 5.0. Submit Bugs and comments to github page.
This is a logo interpreter i have been working on:
http://code.google.com/p/qslogo/
It uses Boost.Spirit for parsing and Qt for the GUI.
Inheritance in Javascript is pretty simple.
function Child(arg1, arg2)
{
Parent.apply(this, arguments);
// .. other methods
}
The apply function calls the Parent function with arguments and sets this to Child’s this object. The arguments variable contains all the arguments passed to Child. (Available since Javascript 1.2).
To create an instance of Child call:
var instance = new Child(x, y);
It is easy to create your own jQuery widgets. First make sure you include the jQuery and jQuery.ui libraries.
The next step is to define our widget using the $.widget helper method.
$.widget("ui.name", {
_init: function() {
},
_privateMethod: function() {
},
method: function(arg1, arg2) {
}
});
The _init function is the constructor of the widget. Methods that start with “_” are private and cannot be accessed. All other methods are public and accessible outside the object by calling:
$("id").name("method_name", par1, par2);
If the method returns a value you need to add it to the object “getter” declaration (See below).
To access the element used to build the widget inside the object use:
this.element
To access the options passed to the widget use:
this.options
To set default properties:
$.extend($.ui.name, {
defaults: {
option: value
}
});
To define “getter” methods:
$.extend($.ui.name, {
getter: [ "method", "method2" ]
});
This is a jQuery widget that transforms a select box to a nice looking double list box. See it in action and download it at: