JavaScript Business Card Test

Script begins here.
End of script.

 

  • Source

    <HTML>
    <HEAD>
    <TITLE>JavaScript Business Cards</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    function PrintCard() {
       document.write("<B>Name:</B> ", this.name, "<BR>");
       document.write("<B>Address:</B> ", this.address, "<BR>");
       document.write("<B>Work Phone:</B> ", this.work_phone, "<BR>");
       document.write("<B>Home Phone:</B> ", this.home_phone, "<HR>");
    }
    function Card(name,address,work,home) {
       this.name = name;
       this.address = address;
       this.work_phone = work;
       this.home_phone = home;
       this.PrintCard = PrintCard;
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <H1>JavaScript Business Card Test</H1>
    Script begins here.<HR>
    <SCRIPT LANGUAGE="JavaScript">
    // Create the objects
    sue = new Card("Sue Suthers", "123 Elm Street", "555-1234", "555-9876");
    phred = new Card("Phred Madsen", "233 Oak Lane", "555-2222", "555-4444");
    henry = new Card("Henry Tillman", "233 Walnut Circle", "555-1299", "555-1344");
    // And print them
    sue.PrintCard();
    phred.PrintCard();
    henry.PrintCard();
    </SCRIPT>
    End of script.
    </BODY>
    </HTML>