Try like this..
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="jquery-1.10.2.js" type="text/javascript"></script>
<script type="text/javascript">
var loading = function () {
var totalCount = 6;
var num = Math.floor(Math.random() * totalCount) + 1
document.body.background = 'images/' + num + '.jpg'
}
</script>
</head>
<body onload=loading();>
<form id="form1" runat="server">
</form>
</body>
</html>