자바스크립트로 배경 이미지 롤링 문제해결 부탁드립니다 T^T// 정보
자바스크립트로 배경 이미지 롤링 문제해결 부탁드립니다 T^T//본문
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> sjisbmoc </title>
<script language='javascript'>
<!--
var pos = 0;
var ary = [
['http://static.naver.com/newscast/2009/0630/105607-217874242.jpg','http://www.paran.com','red'],
['http://static.naver.com/newscast/2009/0630/113501-434767453.jpg','http://www.daum.net','blue'],
['http://static.naver.com/newscast/2009/0630/0948141850870761.jpg','http://www.freechal.com','green'],
['http://static.naver.com/newscast/2009/0630/120429607718678.jpg','http://www.nate.com','yellow']
];
window.onload = function()
{
setImg();
}
function setImg()
{
fncChgImg(ary[pos][0],ary[pos][1]);
fncChgBColor(ary[pos][2]);
setTimeout(setImg,3000);
pos++;
if(pos>=ary.length) pos=0;
}
function fncChgImg(imgSrc, imgLk)
{
var mobj = document.getElementById('ig');
mobj.onclick = function(){ fncLink(imgLk); }
mobj.filters.blendTrans.stop();
mobj.filters.blendTrans.Apply();
mobj.src = imgSrc;
mobj.filters.blendTrans.Play();
}
function fncChgBColor(color)
{
var mobj = document.getElementById('bod');
mobj.filters.blendTrans.stop();
mobj.filters.blendTrans.Apply();
mobj.style.backgroundColor = color;
mobj.filters.blendTrans.Play();
}
function fncLink( url )
{
location.href = url;
}
//-->
</script>
</head>
<body id='bod' style='filter:blendTrans(duration=q);'>
<form name='frm'>
<img id='ig' src='http://static.naver.com/newscast/2009/0630/105607-217874242.jpg' style='filter:blendTrans(duration=q);' style='cursor:hand;' onclick='fncLink("http://www.paran.com");'>
</form>
</body>
</html>
-------------------------------------------------------------------------------------------------
위에 소스를 보면 배경색이 레드, 블루, 그린, 옐로우 로 변하는데
색상대신에 이미지를 보여 줄 수는 없을까요?
fncChgBColor(ary[pos][2]); <------ 이걸
fncChgBColor(ary[pos][0]); <------ 으로 바꾸고
아래~
mobj.style.backgroundColor = color; <------ 이부분을
mobj.style.backgroundImage = ?????; <------- ????? 요걸 바꾸면 될것 같은데 안되네요 .. ㅜㅜ
2일동안 풀지를 못했습니다 T^T.....도움을 부탁드립니다... ㅠ_ㅠ;;;;
아니면
네이버 http://www.nhncorp.com/nhn/index.nhn 의 가운데 큰 이미지 처럼 보여줄 소스가 없을까요?
꼭 필요한데 아무리 검색해도 소스 구하기가 쉽지 않네요.... 부탁드립니다 (--)(__)(--)(__)굽신굽신~
추천
0
0
댓글 3개
해결완료 !! ......흐미..;;
mobj.style.backgroundImage = "url"+ "(" + color + ")"; 이렇게 하니깐 되네요
근데...대형이미지가 중앙에 안오고 왼쪽에서 부터 나오는데 이거 중앙엔 어떻게 해야 하나요?;;
mobj.style.backgroundImage = "url"+ "(" + color + ")"; 이렇게 하니깐 되네요
근데...대형이미지가 중앙에 안오고 왼쪽에서 부터 나오는데 이거 중앙엔 어떻게 해야 하나요?;;
하...정말 모두 해결됐네요 ~ -0-;;
style="background-position:center;" 이렇게 하니깐 됐습니다...
그래도 도움주시려고 했던분들 감사합니다 ㅠ_ㅠ!!
style="background-position:center;" 이렇게 하니깐 됐습니다...
그래도 도움주시려고 했던분들 감사합니다 ㅠ_ㅠ!!
자바스크립트로 배경 이미지 롤링