베너 자동변환
<!doctype html>
<html lang="ko">
<head>
<meta encoding="utf-8">
<title> 베너 자동변환 </title>
<script src="http://code.jquery.com/jquery-2.2.3.min.js"></script>
<style type="text/css">
#changebanner {width:500px;height:100px;background-color:#EEE;border:1px solid #333}
#links{position:relative;left:200px;top:35px}
</style>
</head>
<body>
<script>
$(function() {
var divBg = $("#changebanner");
var banner = [["네이버","http://naver.com"],
["다음","http://daum.net"],
["구글","http://google.com"],
];
setInterval(function() {
var randColor = Math.random()*0xffffff;
randColor = parseInt(randColor);
randColor = randColor.toString(16);
divBg.css({backgroundColor:"#"+randColor});
var randb = Math.random()*banner.length;
randb = parseInt(randb);
$("#links").attr("href",banner[randb][1]);
$("#links").text(banner[randb][0]);
},5000);
});
</script>
<div id="changebanner">
<a id="links" href="#">기본영역</a>
</div>
</body>
</html>