<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
//<![cdata[
$(document).ready(function() {
});
// 키 이벤트 on/off
var on = false;
// jquery 로 keypress 이벤트 발생시 실행
$(document).keypress(function(e) {
// 이벤트(e) code가 97 = a 인 경우 이벤트 발생
if( e.keyCode == 97 ) {
// 한번 발생하면 true
if( on ) {
// src를 네이버로
$("#aaa").attr("src", "http://static.naver.net/www/u/2010/0611/nmms_215646753.gif");
} else {
// false 인 경우 네이트로
$("#aaa").attr("src", "http://main.nateimg.co.kr/img/cms/content_pool/2011/07/normal_bi.gif");
}
// true 를 false로 변경
on = !on;
}
// alert(e.keyCode);
});
//]]>
</script>
</head>
<body>
<img src="http://static.naver.net/www/u/2010/0611/nmms_215646753.gif" id="aaa">
<!--
<img src="http://static.naver.net/www/u/2010/0611/nmms_215646753.gif">
<img src="http://main.nateimg.co.kr/img/cms/content_pool/2011/07/normal_bi.gif">
-->
</body>
</html>