Witam, ucze sie z ksiazki js i tam jest na przykladzie podane jak pisac obiektowo. Napislem sobie taki prosty kod, ale cos nie chce mi działac. Moze ktos pomoze :)
<!DOCTYPE HTML>
<html lang="pl">
<head>
<meta charset="utf8"/>
<script>
function Card(name, address, work, home)
{
this.name = name:
this.address = address;
this.workphone = work;
this.homephone = home;
this.PrintCard = PrintCard;
}
function PrintCard()
{
line1 = "Nazwisko: " + this.name + "<br>\n";
line2 = "Adres: " + this.address + "<br>\n";
line3 = "Telefonw pracy: " + this.workphone + "<br>\n";
line4 = "Telefon domowy: " + this.homephone + "<hr>\n";
document.write(line1 + line2 + line3 + line4);
}
tom = new Card("Tomek Góra", "Grunwaldzka 129", "14 642 76 55", "648 398 836");
</script>
</head>
<body>
<script>
tom.PrintCard();
</script>
</body>
</html>