Thursday, May 28, 2009

Friday, May 15, 2009

Prototype error: Value undefined (result of expression this.fireEvent) is not object.

If you got a js error saying "Value undefined (result of expression this.fireEvent) is not object." when using prototype, make sure you only include prototype.js ONCE in your document.

Thursday, May 07, 2009

Alternate table row color using javascript

This version on javascript has been tested on Firefox, Safari, IE 6, and IE7

$('chart_table').select("tbody tr").each( function(e) {
Event.observe(e, 'mouseover', function() {
Element.addClassName(e, 'hover');
Event.observe(e, 'mouseout', function() {
Element.removeClassName(e, 'hover');

========css =====
.hover{ background-color:#CECECE; color: #fff;}

More detail:

Tuesday, May 05, 2009

Regular expression

For Anchor tag:
preg_match_all('/]*>(.*?)<\/a>/Ui', $post, $matches);

For Image:
preg_match_all('/]*>/Ui', $post, $matches);