css - Change background whit local hour -


this code system hour , change background image

 victorhora = new date  if (victorhora.gethours() > 5) {     imagem = 'my image. im not allowed post link'; } else if (victorhora.gethours() > 18) {     imagem = 'my image. im not allowed post link'; } else {     imagem = 'my image. im not allowed post link'; } </script> <script> $('body').css('background-image', 'url( + imagem + )');  </script> </head> 

but background don't appears think suck's this:

$('body').css('background-image', 'url( + imagem + )'); 

can me?

note: if put document.write(imagem), link appears.

you're not concatenating string.

this

$('body').css('background-image', 'url( + imagem + )'); 

should this:

$('body').css('background-image', 'url( '+ imagem + ')'); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -