2011/03/05

add element after an element

如何在某個element之後新增一個element呢~?
原來jQuery 同 Prototype 都各自有 method



jQuery--
$('#eleId').after('<b>Hello</b>');

Prototype--
$('eleId').insert({
after: '<b>Hello</b>'
});

2011/03/03

sql get parent cat by child id

原來呢個網有教



我再改一下


#get the path by child id, only one row,
SELECT t1.name, t2.name, t3.name
FROM category AS t1
LEFT JOIN category AS t2 ON t2.parent = t1.category_id
LEFT JOIN category AS t3 ON t3.parent = t2.category_id
WHERE (t3.category_id = [child_id])


#get the path by child id, row number = member of family
SELECT t1.* FROM category AS t1
LEFT JOIN category AS t2 ON t2.parent = t1.category_id
LEFT JOIN category AS t3 ON t3.parent = t2.category_id
WHERE 
(t1.category_id = [child_id] OR t2.category_id = [child_id] OR t3.category_id = [child_id])
 ORDER BY t1.LEVEL

2011/03/02

sql sub category

寫了一條sql 去拎sub category
有3層category, 用個parent id 去拎

寫左我好耐... ><

但sub select一定會慢... 要諗下有冇再好d寫先 


#get all child cat by parent id
SELECT ID FROM CATEGORY WHERE ID IN 
(SELECT ID FROM CATEGORY WHERE ID = [parent_id] OR PARENT_ID = [parent_id]) OR PARENT_ID IN
(SELECT ID FROM CATEGORY WHERE ID = [parent_id] OR PARENT_ID = [parent_id])

2011/03/01

css opacity


IE 總是不接受css 的standard
明明css2 已有opacity....

.opacity50{
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";  /*IE8 or bove*/
  filter: alpha(opacity=50); /*IE 5.5 or above*/
  opacity:0.5; /*other browser*/
}