[JS] Toggle-script werkt niet goed
Maar:
- Voor het zien van de pasfoto, moet je 2x klikken op de provincie.
- Bij het klikken op verschillende provincies, komen er meerdere foto's te staan. De ene verdwijnt niet wanneer je op een andere provincie klikt.
Ik heb het layer toggle script overgenomen van deze pagina:
http://phphulp.nl/php/scripts/1/783/
Zelf ben ik niet begaan met JS, maar pogingen tot hebben ook in niets geresulteerd.
Zal iemand mijn scripts kunnen checken?
Pagina: http://www.bsi-bomenservice.nl/02/contact2.php
contact2.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<area shape="poly" alt="" coords="96,87, 101,85, 104,87, 107,90, 110,92, 113,92, 113,87, 115,85, 118,87, 120,92, 123,93, 125,96, 123,98, 123,99, 126,99, 128,104, 123,104, 120,103, 115,104, 110,104, 108,102, 107,103, 100,105, 98,104, 98,99, 101,97, 101,95, 98,93, 96,90" href="#" onClick="setCP('3');klik('erwin', 'bas', 'huib', 'ruud', 'arjan', 'ries', 'leon');">
<div class="iets" id="bas">
<img src="images/pasfoto_bas.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="huib">
<img src="images/pasfoto_huib.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="ruud">
<img src="images/pasfoto_ruud.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="erwin">
<img src="images/pasfoto_erwin.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="arjan">
<img src="images/pasfoto_arjan.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="ries">
<img src="images/pasfoto_ries.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="leon">
<img src="images/pasfoto_leon.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="bas">
<img src="images/pasfoto_bas.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="huib">
<img src="images/pasfoto_huib.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="ruud">
<img src="images/pasfoto_ruud.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="erwin">
<img src="images/pasfoto_erwin.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="arjan">
<img src="images/pasfoto_arjan.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="ries">
<img src="images/pasfoto_ries.jpg" border="0" height="194" width="150"> </div>
<div class="iets" id="leon">
<img src="images/pasfoto_leon.jpg" border="0" height="194" width="150"> </div>
togglelayer.htm
Code (php)
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
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
<style type="text/css" media="screen">
div.iets {
display: none;
}
</style>
<script type="text/javascript">
function klik (did,did2,did3) {
if (document.getElementById(did).style.display == 'none')
{
toggle(did,'display','show');
toggle(did2,'display','hide');
toggle(did3,'display','hide');
}
else
{
toggle(did,'display','hide');
toggle(did2,'display','hide');
toggle(did3,'display','hide');
}
}
function toggle(layer,kind,task) {
if (kind=="visibility"){
if (task=="hide")
vis_to = "hidden";
else if (task=="show")
vis_to = "visible";
else {
if (document.layers)
vis_to = (document.layers[layer].visibility=="hide") ? "show" : "hide";
else if (document.all)
vis_to = (document.all[layer].style.visibility=="hidden") ? "visible" : "hidden";
else if (document.getElementById)
vis_to = (document.getElementById(layer).style.visibility=="hidden") ? "visible" : "hidden";
}
} else if (kind=="display"){
if (task=="hide")
dis_to = "none";
else if (task=="show")
dis_to = "block";
else {
if (document.layers)
dis_to = (document.layers[layer].display=="none") ? "block" : "none";
else if (document.all)
dis_to = (document.all[layer].style.display=="none") ? "block" : "none";
else if (document.getElementById)
dis_to = (document.getElementById(layer).style.display=="none") ? "block" : "none";
}
}
if (document.layers)
(kind=="display") ? document.layers[layer].display = dis_to : document.layers[layer].visibility = vis_to;
else if (document.all)
(kind=="display") ? document.all[layer].style.display = dis_to : document.all[layer].style.visibility = vis_to;
else if (document.getElementById)
(kind=="display") ? document.getElementById(layer).style.display = dis_to : document.getElementById(layer).style.visibility = vis_to;
}
</script>
div.iets {
display: none;
}
</style>
<script type="text/javascript">
function klik (did,did2,did3) {
if (document.getElementById(did).style.display == 'none')
{
toggle(did,'display','show');
toggle(did2,'display','hide');
toggle(did3,'display','hide');
}
else
{
toggle(did,'display','hide');
toggle(did2,'display','hide');
toggle(did3,'display','hide');
}
}
function toggle(layer,kind,task) {
if (kind=="visibility"){
if (task=="hide")
vis_to = "hidden";
else if (task=="show")
vis_to = "visible";
else {
if (document.layers)
vis_to = (document.layers[layer].visibility=="hide") ? "show" : "hide";
else if (document.all)
vis_to = (document.all[layer].style.visibility=="hidden") ? "visible" : "hidden";
else if (document.getElementById)
vis_to = (document.getElementById(layer).style.visibility=="hidden") ? "visible" : "hidden";
}
} else if (kind=="display"){
if (task=="hide")
dis_to = "none";
else if (task=="show")
dis_to = "block";
else {
if (document.layers)
dis_to = (document.layers[layer].display=="none") ? "block" : "none";
else if (document.all)
dis_to = (document.all[layer].style.display=="none") ? "block" : "none";
else if (document.getElementById)
dis_to = (document.getElementById(layer).style.display=="none") ? "block" : "none";
}
}
if (document.layers)
(kind=="display") ? document.layers[layer].display = dis_to : document.layers[layer].visibility = vis_to;
else if (document.all)
(kind=="display") ? document.all[layer].style.display = dis_to : document.all[layer].style.visibility = vis_to;
else if (document.getElementById)
(kind=="display") ? document.getElementById(layer).style.display = dis_to : document.getElementById(layer).style.visibility = vis_to;
}
</script>
Alvast bedankt voor het bekijken van het script.
Er zijn nog geen reacties op dit bericht.