JS不调用函数

时间:2019-02-26 15:47:57

标签: constructor

这是我的呼叫html代码

<!DOCTYPE html>
<html>
<head>
<title>Display Card Type</title>
</head>
<script src='Card.js'; ></script>      
<body>
<script>
    var card = new myCardType();
    var value = new myCardType();
    card.setCard('I am a club');
    value.setFace('I am an Ace');
    card.showSuit();
    value.showFace();
</script>
</body>
</html>

这是单独的功能(保存在同一文件夹中)。

function myCardType(){
    this.suit = suit;
    this.showSuit = function(){
        alert(this.suit);
}
    this.face = value;
    this.showFace = function() {
        alert(this.face);
}
    this.setCard = function (newSuit) {
        this.suit = newSuit;
}
    this.setFace = function (newValue) {
        this.face = newValue;
}

}

花了很多年的时间对此进行审查,但只是看不到发生了什么,感谢任何线索。

0 个答案:

没有答案