WAIC-TEST-0119-01
キーボード及びマウスのイベントハンドラを両方とも使用する
キーボードとマウスの両方のイベントハンドラを使用して、同等の処理を実行できることを確認する
2.1.1
SCR2
function updateImage(imgId, isOver) {
var theImage = document.getElementById(imgId);
if (theImage != null) {
if (isOver) {
theImage.setAttribute('src', './img/WAIC-CODE-0119-01-02.png');
} else {
theImage.setAttribute('src', './img/WAIC-CODE-0119-01-01.png');
}
}
}
<a
href="#"
onmouseover="updateImage('link1', true);"
onfocus="updateImage('link1', true);"
onmouseout="updateImage('link1', false);"
onblur="updateImage('link1', false);"
>
<img
src="./img/WAIC-CODE-0119-01-01.png"
alt=""
id="link1"
width="16"
height="16"
>
リンク 1
</a>
<!-- 「リンク 2」も同様 -->
なし
なし
なし
script 要素, a・buttonなどのフォーカス可能な要素, イベントハンドラー属性