-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaison.js
executable file
·76 lines (68 loc) · 2.36 KB
/
saison.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#<!--<script type="text/javascript" src="../saison.js"></script> -->
#
#<img id="bann_img" src="../images/bannieres/>
# <?php
# if( (isset($_SESSION['bann_form']) && $_SESSION['bann_form'] != "") || isset($_POST['bann_form']))
# {if (isset($_POST['bann_form'])) {$_SESSION['bann_form']=$_POST['bann_form'];}
# $saison=$_SESSION['bann_form'];
# switch ($saison)
# { case "saison1":
# case "saison2":
# echo "ban_vevey_800.png"; break;
# case "saison3":
# echo "ban_moritz_800.png"; break;
# case "saison4":
# echo "ban_choex_800.png"; break;
# }
# }
# else {echo "ban_moritz_800.png";}
# ?> " alt="banniereTJM" onclick="change_saison();"/>
function change_saison() {
var alea;
var nbre_images = 4;
var form, image;
alea = Math.random();
image = document.getElementById('bann_img');
form = document.getElementById('skritii');
if(alea > 0/nbre_images && alea <= 1/nbre_images)
{
image.src = "../images/bannieres/ban_daviaz_800.png";
form.elements["bann_form"].value = "saison1";
}
else if(alea > 1/nbre_images && alea <= 2/nbre_images)
{
image.src = "../images/bannieres/ban_vevey_800.jpg";
form.elements["bann_form"].value = "saison2";
}
else if(alea > 2/nbre_images && alea <= 3/nbre_images)
{
image.src = "../images/bannieres/ban_moritz_800.jpg";
form.elements["bann_form"].value = "saison3";
}
else if(alea > 3/nbre_images && alea <= 4/nbre_images)
{
image.src = "../images/bannieres/ban_choex_800.jpg";
form.elements["bann_form"].value = "saison4";
}
document.forms["skritii"].submit();
} //end of the function
//CHANGE LE RESTE EN CONSEQUENCE
var image = document.getElementById('bann_img');
var fond = document.getElementById('all');
var path = "http://localhost/TJM/images/";
if(image.src == path+"bannieres/ban_daviaz_800.png")
{
fond.style.backgroundImage = 'url(\"'+path+'colonnes_daviaz.png\")' ;
}
else if(image.src == path+"bannieres/ban_vevey_800.png")
{
fond.style.backgroundImage = 'url(\"'+path+'colonnes_vevey.png\")' ;
}
else if(image.src == path+"bannieres/ban_moritz_800.png")
{
fond.style.backgroundImage = 'url(\"'+path+'colonnes_moritz.png\")' ;
}
else if(image.src == path+"bannieres/ban_choex_800.png")
{
fond.style.backgroundImage = 'url(\"'+path+'colonnes_choex.png\")' ;
}