また変えようと思いますww

このデザイン、結構他でも見かけるので、近々、別のに変えようwww
デザイン、コロコロ変えてスマソww

javascriptで特定の要素の属性(title属性、alt属性、type属性etc)を参照、追加および削除する方法

document.getElementById('hoge').getAttribute('属性名');           //参照
document.getElementById('hoge').setAttribute('属性名', '設定値'); //追加
document.getElementById('hoge').removeAttribute('属性名');        //削除

気を付けないといけないのが、属性名がブラウザ(っていうかIEだけか?ww)によって異なる場合があるってとこ。

ある要素のclass属性を参照したい場合、FirefoxOpera

alert(document.getElementById('hoge').getAttribute('class'));

でOKなのに、IEの場合は

alert(document.getElementById('hoge').getAttribute('className'));

って書かないといけない。なので、事前に

var cls = (document.documentElement.getAttribute('style') == document.documentElement.style) ? 'className': 'class';

で、IE or その他のブラウザ を判定させて、

alert(document.getElementById('hoge').getAttribute(cls));

な感じにすれば、クロスブラウザなソースになるのかな。