링크 클릭 후 배경 고정
본문
안녕하세요
링크를 클릭하면 해당 폰트 색상과 배경이 다른곳을 클릭하기 전엔 고정되게 하려고 하고 있습니다.
<style>
a:link, a:visited {color:#fff841}
a:hover {color:#fff}
</style>
<script>
var temp;
function sink(obj) {
if(temp) {
temp.style.color = "";
temp.style.fontWeight = "normal";
}
obj.style.color = "#fff";
obj.style.fontWeight = "bold";
obj.style.background-images = "img/bg.gif";
temp=obj;
}
</script>
<a href="#" onClick="sink(this);">
<p>테스트</p>
</a>
일단 글씨 색상은 클릭 후 고정이 되어있는데요
배경은 바뀌지가 않네요 ㅠ 도움을 요청합니다.!
!-->답변 1
obj.style.background-images = "img/bg.gif";
부분을
obj.style.backgroundImage = "url('img/bg.gif')";
로 수정해서 적용해 보세요.
답변을 작성하시기 전에 로그인 해주세요.