답변 2개 / 댓글 3개
채택된 답변
+20 포인트
<td align=center width="20%" id="test">
<script>
bgimage = "rskekfk";
document.getElementById("test").style.backgroundImage = "url(bgimage)";
</script>
이런식으로 바꿔보세요
document.getElementById("test").style.backgroundImage = "url(" + bgimage + ")";
로 바꿔보세요 그냥 적다가 보니 실수가 있었네요
답변에 대한 댓글 2개
[code]
<td align=center width="20%" id="bgimage2">
<img src="" id="message5" width="90" height="150" />
<img src="" id="message4" width="90" height="150" />
</td>
<script>
document.getElementById( "bgimage2" ).style.backgroundImage = "url(" + bgimage + ")";
</script>
수정해서 해보았는데... 오류는 안나는듯한데.. 백이미지가 들어가지 않아요.ㅠㅠ
<td align=center width="20%" id="bgimage2">
<img src="" id="message5" width="90" height="150" />
<img src="" id="message4" width="90" height="150" />
</td>
<script>
document.getElementById( "bgimage2" ).style.backgroundImage = "url(" + bgimage + ")";
</script>
수정해서 해보았는데... 오류는 안나는듯한데.. 백이미지가 들어가지 않아요.ㅠㅠ
답변을 작성하려면 로그인이 필요합니다.
<table>
<tr>
<td align=center width="20%" id="test">
</tr>
</table>
</html>
<script>
bgimage = "img/0.png";
document.getElementById("test").style.backgroundImage = "url(bgimage)";
</script>
소스입니다.
ㅠㅠ
안되는거 같아여.;;;