[JS] function is not defined, alleen volgens mij wél

Pagina: 1
Acties:

  • kleautviool
  • Registratie: Mei 2003
  • Laatst online: 14-02 09:47
Ik zit nu al een tijdje met het volgende probleem.
Waarschijnlijk zie ik iets over het hoofd ofzo, maar ik snap echt even niet meer wat er fout gaat. Voor een wysiwyg editortje wat ik wil maken heb ik het volgende JS-bestand:

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
    var show = 0;

    /*
      Function to activate the designMode of the Iframe

      Created 31 July 2006 14:51
    */

    function init(id){
        document.getElementById(id).contentWindow.document.designMode = "on";
    }



    /*
      Function to change the textstyle

      Created 31 July 2006 14:52
    */

    function setStyle(style,value){
        document.getElementById('editdocument').contentWindow.document.execCommand(style, false, value);
    }



    /*
      Function to toggle between RICH-TEXT editing and HTML view

      Created 31 July 2006 15:09
    */

    function toggleToHTMLView(){
        if(show == 0) show = 1; else show = 0;
        if(show == 1){
            var html = document.createTextNode(document.getElementById('editdocument').contentWindow.document.body.innerHTML);
            document.getElementById('editdocument').contentWindow.document.body.innerHTML = "";
            document.getElementById('editdocument').contentWindow.document.body.appendChild(html);
        }else{
            var html = document.getElementById('editdocument').contentWindow.document.body.ownerDocument.createRange();
            html.selectNodeContents(document.getElementById('editdocument').contentWindow.document.body);
            document.getElementById('editdocument').contentWindow.document.body.innerHTML = html.toString();
        }
    }



    /*
      Function to change the height of the texfield

      Created 31 July 2006 17:00
    */

    function resetTextLength(changeTo){
        alert("Meeeeelp");
    }



    /*
      Function to show a color pallette to choose a color from

      Created 31 July 2006 17:06
    */

    function setColor(style){
        var palette = document.getElementById('colorPaletteContainer');
        if(palette.style.display == "none"){
            palette.style.display = "block";
        }else{
            palette.style.display = "none";
        }
    }


De laatste functie moet ik overigens nog afmaken, maar de rest werkt, behalve resetTextLength(). Ik krijg continu de error resetTextLength is not defined. Maar wat is er niet goed gedefineerd dan? Volgens mij klopt alles gewoon.
Ik roep de functie op de volgende manier aan:

HTML:
1
<li><img src="http://backend.maurice-k.com/CMS/html/static/lib/im/icons/decrease_editor.gif" onclick="resetTextLength(this.id)" id="decrease" alt="Verklein Tekstveld" title="Verklein Tekstveld"></li>


Zie ik nu iets over het hoofd ofzo :? Ik word nu ongeveer al een week gek denk ik.

  • André
  • Registratie: Maart 2002
  • Laatst online: 11-02 14:19

André

Analytics dude

Je ziet niets over het hoofd, deze code werkt gewoon. Er is dus iets anders fout in je code. Ik heb jet geplaatste code 1 op 1 lokaal gekopieerd en het werkt gewoon.

  • kleautviool
  • Registratie: Mei 2003
  • Laatst online: 14-02 09:47
:? Vreemd. Op die pagina include ik nog een ander JS-document, maar die werkt op alle andere pagina's ook gewoon dus dat lijkt me ook niet fout. Bij deze de code van dat andere JS-document:

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
    var fields = []
        fields['logged'] = "loggedHolder";
        fields['adds'] = "addsHolder";
        fields['edits'] = "editsHolder";
        fields['stats'] = "statsHolder";
    var pref = "";

    /*
      Function to show a requested page in a pop-up

      Created 08 July 2006 20:31
    */

    function pop(url,scroll,width,height){
        var l, t, win;
        l = (screen.width) ? (screen.width - width) / 2 : 100;
        t = (screen.height) ? (screen.height - height) / 2 : 100;
        win = window.open(url,'which','toolbars=0,scrollbars='+scroll+',location=0,statusbars=0,menubars=0,resizable=0,width='+width+',height='+height+',left='+l+',top='+t+'');
        win.focus();
    }



    /*
      Function to show the requested catagory on the frontpage
          * Uses the array FIELDS[] that contains the names of the containers on the frontpage

      Created 21 July 2006 20:44
    */

    function showFPActions(cat){
        if(pref != ""){
            document.getElementById(pref).style.display = "none";
            document.getElementById(pref.replace('Holder','')).className = "";
        }
        document.getElementById(cat+"Holder").style.display = "block";
        document.getElementById(cat).className = "fpActiveDisplay";
        pref = cat+"Holder";
    }



    /*
      Function to show submenu's

      Created 04 June 2006 23:24
    */

    var showSubMenu = function(){
        var parent = document.getElementById("nav").getElementsByTagName("LI"), i;
        for(i=0; i<parent.length; i++){
            parent[i].onmouseover = function(){
                this.className += " active";
            }
            parent[i].onmouseout = function(){
                this.className = this.className.replace(new RegExp(" active\\b"), "");
            }
        }
    }

    if(window.attachEvent) window.attachEvent("onload", active);


edit:
|:( |:( Domdomdomdom

Zie nu dat de fout in de fields array zit :X En die gebruik ik nog geeneens ook :(

Mijn excuses voor dit onnozele topic....

edit 2:
Is het overigens normaal dat de Javascript-console van Firefox kritiek op mijn CSS-bestand gaat zitten leveren?
Bij o.a. deze regel:
Cascading Stylesheet:
1
#loginLarge span:hover,#registratie span:hover{background:#F9FCF5;}

krijg ik dit commentaar:
Expected ':' but found '}'. Declaration dropped.
Nog nooit van gehoord

edit 3:
Oh, het werkt overigens nog steeds niet. Ik heb die fields[] array eruit gehaald, maar krijg nog steeds een resetTextLength is not defined als ik op de knop klik :?

[ Voor 13% gewijzigd door kleautviool op 04-08-2006 17:20 ]


  • André
  • Registratie: Maart 2002
  • Laatst online: 11-02 14:19

André

Analytics dude

Volgens mij doe je iets heel simpel fout, heb je iets online staan?

  • kleautviool
  • Registratie: Mei 2003
  • Laatst online: 14-02 09:47
Ja deze pagina waar het allemaal om gaat.

  • André
  • Registratie: Maart 2002
  • Laatst online: 11-02 14:19

André

Analytics dude

Daar krijg ik geen foutmelding als ik op die knop klik?

Alleen in IE krijg ik op regel 56, teken 28 de melding "active" is niet gedefinieerd.

[ Voor 44% gewijzigd door André op 04-08-2006 20:36 ]


  • kleautviool
  • Registratie: Mei 2003
  • Laatst online: 14-02 09:47
Nu begrijp ik het dus helemaal niet meer.

Nu werkt het inderdaad wel :?

(En ben nog niet met IE bezig dus daar zullen ongetwijfeld fouten in zitten) :)

I.i.g. bedankt voor de hulp!
Pagina: 1