Mozilla/NS laten plaatje niet zien

Pagina: 1
Acties:

  • Limhes
  • Registratie: Oktober 2001
  • Laatst online: 19-08 19:06
Ik heb een js functie gemaakt die menu-items maakt, en die gebruik maakt van document.createElement. Nu laat IE alles goed zien, maar Mozilla en NS laten het plaatje voor het menu-item niet zien.
De js functie is:

code:
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
function makeMenuItem(title, url)
{
  // ref naar td.menu
  cellToAttachOn = document.getElementById("menu");

  // ref naar div#menu
  divToAttach = document.createElement("div");
  divToAttach.style.paddingLeft = "10px";
  divToAttach.style.paddingTop = "3px";
  divToAttach.style.paddingBottom = "3px";
  originalBackgroundColor = divToAttach.style.backgroundColor;
  divToAttach.onmouseover = function(e)
  {
    this.style.backgroundColor = "#ffffff";
    this.children(0).style.visibility = "visible";
  }
  divToAttach.onmouseout = function(e)
  {
    this.style.backgroundColor = originalBackgroundColor;
    this.children(0).style.visibility = "hidden";
  }

  // ref naar div#menu img#menu
  imageToAttach = document.createElement("img");
  imageToAttach.style.visibility = "hidden";
  imageToAttach.setAttribute("src", "img/pijltje.gif");
  imageToAttach.setAttribute("width", "10");
  imageToAttach.setAttribute("height", "10");
  imageToAttach.setAttribute("alt", "");

  // ref naar div#menu a#menu
  anchorToAttach = document.createElement("a");
  anchorToAttach.setAttribute("href", url);
  anchorToAttach.style.paddingLeft = "5px";
  anchorToAttach.appendChild(document.createTextNode(title));

  // img->div, a->div, div->td
  divToAttach.appendChild(imageToAttach);
  divToAttach.appendChild(anchorToAttach);
  cellToAttachOn.appendChild(divToAttach);

  return;
}


De pagina waar ie op staat: http://cp31696-a.roemd1.lb.nl.home.com/sunvalley/index.php

edit:

ik bedacht me net dat Mozilla de children property misschien niet ondersteund... kga het ff nazoeken.

Verwijderd

ik bedacht me net dat Mozilla de children property misschien niet ondersteund... kga het ff nazoeken.
Error: this.children is not a function
Source File: http://cp31696-a.roemd1.lb.nl.home.com/sunvalley/src/menu.js
Line: 24

idd :)

  • Limhes
  • Registratie: Oktober 2001
  • Laatst online: 19-08 19:06
En voor degenen die het willen weten:

IE: parent.children()
'alle' browsers: parent.childNodes.item()