kramann.info
© Guido Kramann

Login: Passwort:










1 Objekte in Javascript

1 Objects in Javascript (EN google-translate)

1 Obiekty w JavaScript (PL google-translate)



Quelltext:

Objects in Javascript

Obiekty w JavaScript

<script language="javascript">
    var objekt = {};
    objekt.name = "Pingpong";
    objekt.show = function(){alert(this.name)};

    function Konstruktor(name)
    {
        this.name = name;
        this.show = function(){alert(this.name)};
    };

    var objekt2 = new Konstruktor("Puck");

    function test()
    {
        objekt.show();
    };

</script>

<form>
    <input type=button value="test" onclick="javascript:test();"/><br/>
    <input type=button value="test2" onclick="javascript:objekt2.show();"/><br/>
</form>

Code 1-1: Quelltext zu obigem Beispiel