差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
| study:javascript:event [2008/02/02 11:36] – banana | study:javascript:event [2008/03/20 01:51] (現在) – banana | ||
|---|---|---|---|
| 行 2: | 行 2: | ||
| document.compatMode | document.compatMode | ||
| - | - Quirks mode(" | + | - Quirks mode[BACKCompat] |
| - | - Strict mode("CSS1Compat" | + | - Strict mode[CSS1Compat] : Standard-compliant mode is switched on. |
| - | < | + | < |
| function getPosition(e) { | function getPosition(e) { | ||
| e = e || window.event; | e = e || window.event; | ||
| 行 27: | 行 27: | ||
| </ | </ | ||
| + | {{keywords> | ||
| 行 51: | 行 51: | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ====== Change background color of a selected row ====== | ||
| + | <code javascript> | ||
| + | function TT_click(oR) { | ||
| + | var oT = oR.parentNode.parentNode; | ||
| + | | ||
| + | oR.style.backgroundColor = ''; | ||
| + | oT.targetRec = false; | ||
| + | } else { | ||
| + | if(oT.targetRec)oT.targetRec.style.backgroundColor = ''; | ||
| + | oR.style.backgroundColor = oT.currentBackgroundColor; | ||
| + | oT.targetRec = oR; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function TT(Tid, | ||
| + | var oT = document.getElementById(Tid); | ||
| + | if(! oT)return; | ||
| + | |||
| + | | ||
| + | oT.rows[i].onclick=function(){TT_click(this); | ||
| + | } | ||
| + | oT.targetRec=false; | ||
| + | oT.currentBackgroundColor=SetColor; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Code sample ===== | ||
| + | <code html> | ||
| + | <BODY bgcolor="# | ||
| + | <form name=" | ||
| + | |||
| + | <テーブルをクリックすると行の色が変わるサンプル> | ||
| + | |||
| + | <TABLE id=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | |||
| + | <script type=" | ||
| + | <!-- | ||
| + | TT(' | ||
| + | //--> | ||
| + | </ | ||
| + | </ | ||
| + | |||