<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Homeostat 3</title> <meta http-equiv="refresh" content="5; url=./room_4.html"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <style type="text/css"> body {font-family: mono; position: relative; background-image: url('./img/29.jpg'); background-position: 950px -30px; } h1 {background-color: white; width: 215px; padding: 6px;} #n1 {width: 684px; height: 260px; position: absolute; left: 1141px; top: -17px;} #n2 {width: 270px; height: 534px; position: absolute; left: 1580px; top: 424.6px;} #n3 {width: 278px; height: 206px; position: absolute; left: 1268px; top: 793px; background-position: -380px 825px;} #n4 {width: 528px; height: 407px; position: absolute; left: 1019px; top: 393px;} a#n1:hover { background-image: url(./img/35.jpg); } a#n2:hover { background-image: url(./img/17.jpg); } a#n3:hover { background-image: url(./img/30.jpg); } a#n4:hover { background-image: url(./img/24.jpg); } </style> </head> <body> <h1><a href="./room_3.html" target="blank">Homeostat 3</a></h1> <img id="img1" style="width: 640px;" src="./img/12.jpg" > <a class="h" href="" id="n1"></a> <a class="h" href="" id="n2"></a> <a class="h" href="" id="n3"></a> <a class="h" href="" id="n4"></a> <script type="text/javascript"> var room = ["living_room.html", "dining_room.html"]; function randomInt(){ return Math.ceil(Math.random() * 2)-1; } $('.h').each(function(){ $(this).attr("href", room[randomInt()] ); }); </script> </body> </html>