ik ben bezig met een script om alle divs met dezelfde NAME te (un)hiden door middel van bijvoorbeeld een knop.
ik ben nu al een heel eind op weg maar helaas werkt het NIET in internet explorer.
ik denk dat het te maken heeft met de ITEM() functie.
reageert deze anders in internet explorer?
Is dit de verhelpen?
Alternatieve functie?
alvast bedankt
ik ben nu al een heel eind op weg maar helaas werkt het NIET in internet explorer.
ik denk dat het te maken heeft met de ITEM() functie.
reageert deze anders in internet explorer?
Is dit de verhelpen?
Alternatieve functie?
alvast bedankt
JavaScript:
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
| <html> <head> <script> function hideshow(naam){ elements = document.getElementsByName(naam); var stop = 0; for(teller=0;stop!=1;teller++){ if(elements.item(teller)){ if(elements.item(teller).style.display != "none"){elements.item(teller).style.display = "none"} else{elements.item(teller).style.display = "block"} }else{stop = 1;} } } </script> <style> div.box{ background:black; width:100px; height:100px; color:white; margin:10px; padding:5px; text-align:center; display:block; } </style> </head> <body> <table> <tr> <td valign="top"> <input type="button" value="Hide alpha" onclick="hideshow('alpha')"></button> <DIV class="box" name="alpha"> alpha box 1 </DIV> <DIV class="box" name="alpha"> alpha box 2 </DIV> <DIV class="box" name="alpha"> alpha box 3 </DIV> <DIV class="box" name="alpha"> alpha box 4 </DIV> </td> <td valign="top"> <input type="button" value="Hide beta" onclick="hideshow('beta')"></button> <DIV class="box" name="beta"> beta box 1 </DIV> <DIV class="box" name="beta"> beta box 2 </DIV> <DIV class="box" name="beta"> beta box 3 </DIV> <DIV class="box" name="beta"> beta box 4 </DIV> </td> <td valign="top"> <input type="button" value="Hide gamma" onclick="hideshow('gamma')"></button> <DIV class="box" name="gamma"> gamma box 1 </DIV> <DIV class="box" name="gamma"> gamma box 2 </DIV> <DIV class="box" name="gamma"> gamma box 3 </DIV> <DIV class="box" name="gamma"> beta box 4 </DIV> </td> </tr> </table> </body> </html> |