html - Get Different Images from one URL -


for example,

http://placeimg.com/640/480/people

is 1 url. if reload page, comes new image. website has background image, , want random image of 2 images:

http://bit.do/bgimage1

http://bit.do/bgimage2

how can achieve this? , calling of image in css.

in javascript

function setrandomimg(){ var items = ['url','url'] var item = items[math.floor(math.random()*items.length)]; document.getelementbyid(id-of-your-body/container).style.background-image='url('+item+')' } 

and add onload container (example <body onload='setrandomimg()'>)


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -