[js] dodawanie elementów

0

Witam, mam problem ze skryptem, ktory napisałem. Powiem szczerze, że nie wiem dlaczego to nie działa:

<!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" xml:lang="pl">

    <head>

        <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />

        <link rel="stylesheet" href="css/glowna.css" type="text/css" />
        <title>Stronka w budowie...</title>
        
        <script type="text/javascript">
            
            function CMenu()
            {
                var start = document.createElement("table");
                document.getElementById("menu").appendChild(start);
                //document.body.appendChild(start);
                
                this.AppMenuPos = function(text)
                {
                    var row = document.createElement("tr");
                    row.style.backgroundColor = "#FFF";
                    
                    var column = document.createElement("td");
                    column.style.width = "150px";
                    column.innerHTML += text;
                    
                    row.appendChild(column);
                    start.appendChild(row);
                }
            
            }
            
        </script>

    </head>
    
    <body>
    
        <!-- logo na górze -->
        <div style="margin: auto auto; width: 760px; height: 151px; background: url(grafa/up.jpg);">
        </div>
        
        <div style="margin: auto auto; width: 760px">
        
            <table cellpadding="0" cellspacing="0">
                <tr>
                
                    <!-- menu -->
                    <td id="menu" onload="var menu=CMenu(); menu.AppMenuPos('przycisk');"></td>
                   
                </tr>
            </table>
        </div>
    </body>

</html>
0

Po pierwsze to element TD nie obsługuje zdarzenia onload, poza tym powinno być: var menu = new CMenu();

0

Dzięki za pomoc. Jestem nowy w tym temaci i zapomniałem o tym new :P

1 użytkowników online, w tym zalogowanych: 0, gości: 1