안녕하세요
링크를 클릭하면 해당 폰트 색상과 배경이 다른곳을 클릭하기 전엔 고정되게 하려고 하고 있습니다.
Copy
<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개 / 댓글 2개
채택된 답변
+20 포인트
obj.style.background-images = "img/bg.gif";
부분을
obj.style.backgroundImage = "url('img/bg.gif')";
로 수정해서 적용해 보세요.
답변에 대한 댓글 2개
답변을 작성하려면 로그인이 필요합니다.