Home  >  Article  >  Web Front-end  >  js changes background_html/css_WEB-ITnose

js changes background_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:15:48877browse

There is a problem with changing the background in js. I use aa.style.background="url(2.jpg)"; there is always something wrong. Please give me some advice. The code is as follows

<!DOCTYPE html><html><head><script>  function fun(){  // var Arr=new Array( "1.jpg ", "2.jpg ")   //  var i=0 ;   var aa=document.getElementById("aa");   aa.style.background="url(2.jpg)";   alert("sdfsdfsdf"); }</script>  </head><body><table width=500 height=100 id= "aa " background="1.jpg" >  <tr> <td>  aaaa  </td> </tr>  </table>  <input type="submit" value="Button" id="bb" onClick="fun();"/></body></html>


Reply to discussion (solution)

d8a054b2f37d7b48b1058027042a92a5

Me Made another stupid mistake

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn