2009年4月4日土曜日

見え隠れするコード領域

toggleMyCode.js
<script type="text/javascript">
function getNS(children, target, found, index){
if(children.length == index){return null;}
if(found){return children[index];}
if(target == children[index]){found=true;}
return getNS(children, target, found, index+1);
}
function toggleMyCode(me){
var item = getNS(me.parentElement.children, me, false, 0);
if(!item){ return; }
var style = item.style;
if('none' == style.display){
style.display = 'block';
}else{
style.display = 'none';
}
}
</script>

0 件のコメント:

コメントを投稿