JavaScript

DOM操作するならツリーの親子関係はきちんと把握しとけつーこと

document.body.appendChild(hoge)

したら

document.removeChild(hoge)

じゃ消せないよ。当たり前だよアホカオレ orz


IEではいいから

bar.getAttribute('hoge', 2);
bar.setAttribute('hoge', foo, 0);

と書いとけと言うこと
getAttributeは2を指定しないと俺アトリビュート(TALとか)を取得できないの
setAttributeはデフォルトでケースセンシティブにマッチングしやがりますの


イベントでキーコードを取得したいときは何も言わずにこう(eがイベントオブジェクト)

var keycode = e.keyCode || e.which;

文字に直したいときは

String.fromCharCode(keycode);

Ctrlとかの修飾キーは

e.ctrlKey, e.altKey, e.shiftKey


エレメントの位置を取得したいときは

getElementPos = function(targetNode){
	var Result = {x:0,y:0};
	while (targetNode){
		Result.x += targetNode.offsetLeft;
		Result.y += targetNode.offsetTop;
		targetNode = targetNode.offsetParent;
	}
	return Result;
};


IEのDOM/xmlHttpRequestオブジェクトとかは多分内部COMなんでレイトバインドできない


以上