css - id (used by javascript) not working when used with div and div has image coming on after the other -
css - id (used by javascript) not working when used with div and div has image coming on after the other -
javascript:
window.onload = changeimage; //by e. function changeimage() { var image = document.getelementbyid(myimage); //here must set image's address want appear after 10 seconds. function toimage2() { image.src = "image2.jpg"; //and after 250 seconds, phone call first image again. settimeout(toimage1, 10000); } function toimage1() { image.src = "image1.jpg"; //10 seconds have passed, phone call sec image. settimeout(toimage2, 10000); } //after 10 seconds, toimage2() function called. settimeout(toimage2, 10000); }
html:
<div id="myimage" style="background-image: url(image1.jpg); width: 100%; height: 100px; ">lalal <br>dsdf <br> add together more <br>more <br>more </div>
image not changing :/ new css ,html , javascript , need help
you need alter var image = document.getelementbyid(myimage);
var image = document.getelementbyid('myimage');
furthermore, 'image' background on div element, instead of assigning 'src' (a property of image, , not div), need assign style background-image. image.style.backgroundimage= "url(/path/to/image.jpg)"
work, it's not setting source element, style background image.
javascript css
Comments
Post a Comment