Toon posts:

[JS/PHP] Niet helemaal cross-browser?

Pagina: 1
Acties:
  • 39 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik snap er even helemaal niks meer van.
Het gaat om een script met een stuk JavaScript er in voor een uitklapmenu. De inhoud wordt gegenereerd door PHP.
Dat script werkt feilloos in IE, maar niet in Firefox. Maar als ik de source opsla en het dan bekijk, werkt het in beide. 8)7
Iemand nog idee-en?

  • Rowanov
  • Registratie: Februari 2004
  • Niet online

Rowanov

Kop eens wat anders...

De source posten want hier hebben we geen drol aan.

  • gorgi_19
  • Registratie: Mei 2002
  • Laatst online: 27-04 18:17

gorgi_19

Kruimeltjes zijn weer op :9

En wat heeft PHP er mee te maken? Het is een clientside probleem; de serverside language doet er dan niet toe. Oftewel: we kunnen weinig zonder de clientside code en / of een voorbeeld online; de PHP code hebben we niets aan.

[ Voor 35% gewijzigd door gorgi_19 op 14-09-2005 17:41 ]

Digitaal onderwijsmateriaal, leermateriaal voor hbo


Verwijderd

Topicstarter
OK, komtie:
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Menu4</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <SCRIPT LANGUAGE="JavaScript">
            <!--
                // Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.
                // Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
                
                var caution = false;
                function setCookie(name, value, expires, path, domain, secure) {
                    var curCookie = name + "=" + escape(value) +
                        ((expires) ? "; expires=" + expires.toGMTString() : "") +
                        ((path) ? "; path=" + path : "") +
                        ((domain) ? "; domain=" + domain : "") +
                        ((secure) ? "; secure" : "")
                    if (!caution || (name + "=" + escape(value)).length <= 4000){
                        document.cookie = curCookie;
                    } else {
                        if (confirm("Cookie exceeds 4KB and will be cut!")) document.cookie = curCookie;
                    }
                }
                function getCookie(name) {
                    var prefix = name + "=";
                    var cookieStartIndex = document.cookie.indexOf(prefix);
                    if (cookieStartIndex == -1) return null;
                    var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
                    if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
                    return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
                }
                function deleteCookie(name, path, domain) {
                    if (getCookie(name)) {
                        document.cookie = name + "=" +
                        ((path) ? "; path=" + path : "") +
                        ((domain) ? "; domain=" + domain : "") +
                        "; expires=Thu, 01-Jan-70 00:00:01 GMT"
                    }
                }
                function fixDate(date) {
                    var base = new Date(0);
                    var skew = base.getTime();
                    if (skew > 0) date.setTime(date.getTime() - skew);
                }
                function item(parent, text, depth) {
                    this.parent = parent;
                    this.text = text;
                    this.depth = depth;
                }
                function makeArray(length) {
                    this.length = length;
                }
                function makeDatabase() {

                    outline = new makeArray(14);

                    outline[0] = new item(true, '<a href="php/age/calendar.php">Agenda</a>', 0);
                    outline[1] = new item(false, '<a href="php/age/config.php">Configuratie</a>', 1);
                    outline[2] = new item(true, 'Testmodule', 0);
                    outline[3] = new item(false, 'subtest', 1);
                    outline[4] = new item(true, 'testsub_III', 1);
                    outline[5] = new item(false, '<a href="php/admin/config.php">testerdetestinvoegen</a>', 2);
                    outline[6] = new item(false, 'testsub_II', 1);
                    outline[7] = new item(true, 'Beheer', 0);
                    outline[8] = new item(false, '<a href="php/admin/modules.php">Modules</a>', 1);
                    outline[9] = new item(false, '<a href="php/admin/usergroups.php">Gebruikersgroepen</a>', 1);
                    outline[10] = new item(false, '<a href="php/admin/users.php">Gebruikers</a>', 1);
                    outline[11] = new item(false, '<a href="php/admin/security.php">Security</a>', 1);
                    outline[12] = new item(false, '<a href="php/admin/config.php">Configuratie</a>', 1);
                    outline[13] = new item(false, '<a href="php/admin/help.php">Help</a>', 1);
                    
                    setStates();
                    setImages();
                }
                
                function setStates() {
                    var storedValue = getCookie("outline");
                    
                    if (!storedValue) {
                        for (var i = 0; i < outline.length; ++i) {
                            if (outline[i].depth == 0){
                                outline[i].state = true;
                            } else{
                                outline[i].state = false;
                            }
                        }
                    } else {
                        for (var i = 0; i < outline.length; ++i) {
                            if (storedValue.charAt(i) == '1'){
                                outline[i].state = true;
                            } else {
                                outline[i].state = false;
                            }
                        }
                    }
                }
                function setImages() {
                    for (var i = 0; i < outline.length; ++i) {
                        if (outline[i].state){
                            if (outline[i].parent){
                                if (outline[i + 1].state) {
                                    outline[i].pic = '<a href="javascript:toggle(' + i + ')">[img]"images/exploded.gif"[/img]</A>';
                                } else {
                                    outline[i].pic = '<a href="javascript:toggle(' + i + ')">[img]"images/collapsd.gif"[/img]</A>';
                                }
                            } else {
                                outline[i].pic = '';
                            }
                        }
                    }
                }
                function toggle(num) {
                    for (var i = num + 1; i < outline.length && outline[i].depth >= outline[num].depth + 1; ++i) {
                        if (outline[i].depth == outline[num].depth + 1){
                            outline[i].state = !outline[i].state;
                        }
                    }
                    setStorage();
                    history.go(0);
                }
                function setStorage() {
                    var text = "";
                    for (var i = 0; i < outline.length; ++i) {
                        text += (outline[i].state) ? "1" : "0";
                    }
                
                    setCookie("outline", text);
                }

                makeDatabase();
            // -->
        </SCRIPT>
    </head>

    <body>
    <SCRIPT LANGUAGE="JavaScript">
        <!--
            document.write('<pre>')
            for (var i = 0; i < outline.length; ++i) {
                if (outline[i].state) {
                    for (var j = 0; j < outline[i].depth * 5; ++j) {
                        document.write(' ');
                    }
                    document.write(outline[i].pic, ' ', outline[i].text, '<br>')
                } else {
                    var previous = i;
                    for (var k = i + 1; k < outline.length && outline[k].depth >= outline[previous].depth; ++k) {
                        ++i;
                    }
                }
            }
            document.write('</pre>')
        // -->
    </SCRIPT>

    </body>
</html>

  • gorgi_19
  • Registratie: Mei 2002
  • Laatst online: 27-04 18:17

gorgi_19

Kruimeltjes zijn weer op :9

// Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
Geen optie om de maker te mailen of om een ander script te halen van bijvoorbeeld hotscripts.com?

Digitaal onderwijsmateriaal, leermateriaal voor hbo


  • Willem
  • Registratie: Februari 2001
  • Laatst online: 01:35
what he says ^

Verder is het hier niet de Ooypunk-debug-helpdesk.
Doe eens wat meer moeite door zelf te beginnen met debuggen. :)

Motor onderhoud bijhouden

Pagina: 1

Dit topic is gesloten.