php - Change background randomly when the page is refreshed -


i have 10 image files in folder ( images ) named 1.jpg 10.jpg

what want change background randomly every time page refreshed

this have tried far :

<body background='<?php echo 'images/'.rand(1,6).'.jpg' ?>'> 

this doesn't work .

can tell me how using php, please ?

<script> $(function(){ var min = 1; var max = 6; var random = math.floor(math.random() * (max - min + 1)) + min; $("body").css("background-image","url(images/"+random+".jpg") }): </script> 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -