Chrome不会加载简单的JavaScript

时间:2016-06-14 23:18:31

标签: javascript html google-chrome

我在head标记内的JavaScript:

<script type="text/javascript">
function over1() {
    var img1 = document.getElementById("1").src;
    document.getElementById("big").src = img1;
}

function out() {
    document.getElementById("big").src = "http://icons.iconarchive.com/icons/paomedia/small-n-flat/1024/shop-icon.png";
}

function london() {
    var city = document.getElementById("city").value;
    var check = city.toLowerCase();
    var province = document.getElementById("province").value;

    if (check == "london" && province == "ON") {
        alert("Visit our company travel store at Masonville Mall!");
    }
}

function  checkinput()  {
    var email = document.contest.email.value;
    var emailcheck = email.search("@");

    if (!document.contest.name.value)  {
        alert("Enter a name!")

    } else {

        alert("Thank You " + document.contest.name.value + " " + document.contest.lastname.value + " For Entering The Contest!")
        window.open(calculator.html,'_blank');
    }
}
</script>

我在HTML文件中有简单的JavaScript,但Chrome不会读取它。在Inspector View中,它会为我的所有函数抛出ReferenceErrors。请帮忙。

1 个答案:

答案 0 :(得分:1)

为什么这么说,这些都是函数,没有从这些函数调用。调用函数并查看它们是否被正确调用

      checkinput();
      over1();
      /* the rest of them */