<div id="test"></div>
<div id="test2">Hello World!</div>
var $ = function(a)
{
if(this.$) return new $(a);
this.elem = document.getElementById(a);
}
$.prototype = {
css: function(obj, str)
{
if(typeof obj == 'object') for(var i in obj) this.elem.style[i] = obj[i];
else if(typeof obj == 'string' && str) this.elem.style[obj] = str;
return this;
}
html: function(text)
{
if(text) this.elem.innerHTML = text;
else return this.elem.innerHTML;
return this;
}
}
$('test').html('This is text').css({
color: 'red',
fontWeight: 'bold',
textAlign: 'center'
});
alert( $('test2').html() ); //Hello World!
$('test2').css('color', 'green');
Как пример.