배경이미지를 사용자에 의해 변경할수 있는 방법 정보
개발자 배경이미지를 사용자에 의해 변경할수 있는 방법본문
배경이미지를 사용자에 의해 변경할수 있는 소스를 찾다 아래와 같은 내용을 확인했습니다.
그런데 원하는 배경을 선택한후 새로고침을 하게 되면 - 즉 페이지를 이동하게 되면 - 원래의 처음 배경으로
돌아옵니다.
페이지가 새로고침되도 선택된 배경이 유지될수 있는 조언을 구합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>back</title>
<script language='javascript' type='text/javascript'>
//<![CDATA[
<html>
<head>
<title>back</title>
<script language='javascript' type='text/javascript'>
//<![CDATA[
var ary = new Array();
ary.push('http://thumb.opencast.naver.net/opencast01/d/o/doldoly2002/20100403/2328333933853.jpg?type=f10060');
ary.push('http://thumb.opencast.naver.net/opencast01/d/o/doldoly2002/20100403/23494064089956.jpg?type=f10060');
ary.push('http://thumb.opencast.naver.net/opencast01/d/o/doldoly2002/20100403/23353148487012.jpg?type=f10060');
ary.push('http://thumb.opencast.naver.net/opencast01/d/o/doldoly2002/20100403/23391992675918.jpg?type=f10060');
window.onload = function()
{
}
function fncChange(pos)
{
document.body.style.backgroundImage ='url("'+ary[Number(pos)]+'")';
}
//]]>
</script>
<style type='text/css'>
#maketop {background-color: transparent;}
#makebanner {background-color: transparent;}
body
{
background-image: url('http://thumb.opencast.naver.net/opencast01/d/o/doldoly2002/20100403/2328333933853.jpg?type=f10060');
background-repeat: no-repeat;
background-position: top center;
}
</style>
</head>
<body>
<input type='button' onclick='fncChange(0)' value='1번 배경'/>
<input type='button' onclick='fncChange(1)' value='2번 배경'/>
<input type='button' onclick='fncChange(2)' value='3번 배경'/>
<input type='button' onclick='fncChange(3)' value='4번 배경'/>
</body>
</html>
잘부탁드립니다.
추천
0
0
댓글 8개

DB든 쿠키든 XML이든 현재 상태값을 저장 않하고 이게 가능한가요? 방법이 있으면 저도 알고 싶네요~ㅎ
위의 소스랑은 다른 구성이겠지만, 쿠키로 적용을 하는듯 한데 http://www.hangloose.co.kr/front/php/login/login_f.php 에서
가능한것 처럼 보이네요...ㅠㅠ 고수분들은 가능하지 않을까요?....ㅠㅠ
가능한것 처럼 보이네요...ㅠㅠ 고수분들은 가능하지 않을까요?....ㅠㅠ

쿠키로는 가능하죠~ㅋ
그럼 위의 소스를 수정하여 쿠키적용이 가능하도록 변경이 가능하신가요? 가능하시다면 답변을 부탁드립니다.ㅠㅠ

적어주신 주소로가서 까보니 쿠키값으로 숫자 저장한다음에
배경 로딩때, 해당 숫자에 할당된 배경으로 뿌려주는 것 같아요 ㅇ_ㅇ..
배경 로딩때, 해당 숫자에 할당된 배경으로 뿌려주는 것 같아요 ㅇ_ㅇ..
그 기능이 위의 소스에 추가가 가능할까요? ㅜㅜ

자바스크립트로 쿠키를 다루는 부분에 대해서 조금 검색해보면 무리없이 적용 가능할 것 같아요 ^^
제가 초보라....검색만 보름을 넘어가는데...진전이 없네요 ㅜㅜ 도움을..부탁드립니다. ㅠㅠ