td 백그라운드 자바스크립트 처리시에 익스, 크롬이 다르게 출력되네요.

td 백그라운드 자바스크립트 처리시에 익스, 크롬이 다르게 출력되네요.

QA

td 백그라운드 자바스크립트 처리시에 익스, 크롬이 다르게 출력되네요.

답변 2

본문

td 백그라운드 자바스크립트 처리시에 익스, 크롬이 다르게 출력되네요.

 


 
 <td align=center id="bgimage4">
  <img src="" id="message1" width="70" height="100" />
  <img src="" id="message" width="70" height="100" />
  </td>
 <td align=center width="5%">
  <div style="font-size:75px"><font color="white">:</font></div>
 </td>
<td align=center id="bgimage3">
  <img src="" id="message3" width="70" height="100" />
  <img src="" id="message2" width="70" height="100" />
 </td>
 <td align=center width="5%">
  <div style="font-size:75px"><font color="white">:</font></div>
  </td>
 <td align=center id="bgimage2" width="300" height="202">
  <img src="" id="message5" width="60" height="100" />
  <img src="" id="message4" width="60" height="100" />
 </td>
 
 
 
 
 
 
<script>
  document.getElementById( "bgimage2" ).background = bgimages;
  document.getElementById( "bgimage3" ).background = bgimagem;
  document.getElementById( "bgimage4" ).background = bgimageh; 
</script>

 

위 소스와같이 여러분들의 도움으로. 구현했습니다. 백그라운드이미지로 삽입시켜 출력하게 잘나오는데요.

문제는.... 익스플로어에서는 잘됩니다만,

크롬에서는 백그라운드 이미지가 전혀 출력이 안되네요. .

 

익스크롬, 둘다 되게 하는 방법이 어떤것이 있을가요? ...

도움부탁드립니다.

 

감사합니다. 

이 질문에 댓글 쓰기 :

답변 2

document.getElementById( "bgimage2" ).style.backgroundImage = "url('"+bgimages+"')"; 

자바스크립트 backgroundImage






<td align="center" width="20%" id="test"> 


<td align="center" width="20%" id="test2"> 


<script>

bgimages = "0.jpg"; 

bgimagem = "1.jpg"; 




document.getElementById('test').style.backgroundImage='url(' + bgimages + ')';

document.getElementById('test2').style.backgroundImage='url(' + bgimagem + ')';

</script>









위 코드에서

document.getElementById('test').style.backgroundImage='url(' + bgimages + ')';

이것만 사용해서 출력할때는 잘됩니다.

그러나

document.getElementById('test').style.backgroundImage='url(' + bgimages + ')';

document.getElementById('test2').style.backgroundImage='url(' + bgimagem + ')';

2개를 넣어 출력할려할시에는 1개만 나오네요. 에러가 나지는 않고요.

그냥 정상적으로 test 만 출력이 됩니다. test2 는 작동안하네요.;;




조언 및 답변 부탁드립니다.

감사합니다.

jquery를 사용하시면 안되는 건가요 ? 

해당 작업은 비표준인데요..

답변을 작성하시기 전에 로그인 해주세요.
전체 3
© SIRSOFT
현재 페이지 제일 처음으로