web,direction,planning,graphicdesign

2009年3月3日火曜日

javascriptの基礎

javascriptの基礎

○stylesheetの設定を変えるときは
「.」でつないでいく。「-」のところは直後にくる文字を大文字で。


h1.style.backgroundColor

○以下でもできる

contents0.setStyle("display:none")


○設定

var January = 変数

function February (引数){

};

○実行

February(戻り値);


■任意の色にh1タグの色を変えてみる

○js

function changeClr (colorValue) {
var h1 = document.getElementById("header-title");
h1.style.backgroundColor = colorValue;
}

○html

<a href="#" onmouseover="changeClr('#ff0000')"
onmouseout="changeColor('transparent')">背景色を赤にする</a>

0 件のコメント:

フォロワー