【info】いつもいろいろなテストなどをページ内のあちこちでやっているので、重かったり、壊れていたりするf^^;ことも多いです。実験用ですので、カオス(混沌)をあえて意図したりもしますので、標準やValidとは無縁だったりしますが、何卒、ご了承ください ( _ _ b
class属性値をgetAttributeで取るときは、下記に注意。すっかり忘れてました(^^;
oj.getAttribute('class') ←FireFox,Opera,Safari
oj.getAttribute('className') ←IE
クロスブラウザな書き方は下記でOK
oj.getAttribute('class')||oj.getAttribute('className')
例
if(oj.getAttribute('class')||oj.getAttribute('className')=='xxx'){ ... }
if((oj.getAttribute('class')||oj.getAttribute('className'))=='xxx'){ ... }
oda さんの仰るとおり、 == の方が || より優先されますね。
var attr = oj.getAttribute('class')||oj.getAttribute('className')=='xxx';
とすると、
Gecko では、 attr には属性値が入り、
Trident では、属性値が 'xxx' と等しいか評価した結果(boolean)が入るようです。
意図通りの分岐を書くなら、
if ( ( oj.getAttribute('class')||oj.getAttribute('className') ) == 'xxx' ){ ... }
ですかね。
おぉ、なんと素早いつっこみありがとうございます(^^;;
直しました。
| 日 | 月 | 火 | 水 | 木 | 金 | 土 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |



