테스트 사이트 - 개발 중인 베타 버전입니다

배경이미지를 사용자에 의해 변경할수 있는 방법

배경이미지를 사용자에 의해 변경할수 있는 소스를 찾다 아래와 같은 내용을 확인했습니다.
그런데 원하는 배경을 선택한후 새로고침을 하게 되면 - 즉 페이지를 이동하게 되면 - 원래의 처음 배경으로
돌아옵니다. 
페이지가 새로고침되도 선택된 배경이 유지될수 있는 조언을 구합니다.
 
 
<!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[

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>
 
 
잘부탁드립니다.

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 8개

DB든 쿠키든 XML이든 현재 상태값을 저장 않하고 이게 가능한가요? 방법이 있으면 저도 알고 싶네요~ㅎ
위의 소스랑은 다른 구성이겠지만, 쿠키로 적용을 하는듯 한데 http://www.hangloose.co.kr/front/php/login/login_f.php 에서
가능한것 처럼 보이네요...ㅠㅠ 고수분들은 가능하지 않을까요?....ㅠㅠ
쿠키로는 가능하죠~ㅋ
그럼 위의 소스를 수정하여 쿠키적용이 가능하도록 변경이 가능하신가요? 가능하시다면 답변을 부탁드립니다.ㅠㅠ
적어주신 주소로가서 까보니 쿠키값으로 숫자 저장한다음에
배경 로딩때, 해당 숫자에 할당된 배경으로 뿌려주는 것 같아요 ㅇ_ㅇ..
그 기능이 위의 소스에 추가가 가능할까요? ㅜㅜ
자바스크립트로 쿠키를 다루는 부분에 대해서 조금 검색해보면 무리없이 적용 가능할 것 같아요 ^^
제가 초보라....검색만 보름을 넘어가는데...진전이 없네요 ㅜㅜ 도움을..부탁드립니다. ㅠㅠ

게시글 목록

번호 제목
32071
32070
18535
5369
27088
5364
32069
32068
18521
5359
18520
32067
32066
27081
18514
5355
5354
5350
32065
18510
18503
32064
32063
18502
18499
18495
5345
27079
30718
18494
18493
5343
18491
18489
18487
18486
18484
18482
32062
26476
18481
5339
18480
18476
27137
30711
18475
18474
18470
32061
18469
32060
5335
32059
5333
32058
32057
30705
5326
18466
18462
18461
31504
30696
32056
5321
18456
18455
32055
5315
5310
27072
32054
27066
18453
30692
30690
18451
18450
18449
5307
32051
18448
18447
18441
18437
18429
32049
30686
5299
5289
30677
32042
18426
18422
18420
18418
5285
5282
26459