"未捕获的SyntaxError:意外的令牌< "在第一行

时间:2016-08-30 14:37:59

标签: javascript jquery web

我知道这个问题已被多次询问,但我无法找到解决问题的方法。

在我的本地机器上一切都很好,但是当我将文件上传到服务器(000webhost)时,我有六个错误,并且这些错误的描述是

  

未捕获的SyntaxError:意外的标记<

提前致谢。

The domain of my website.

这是我的HTML

  public static void main(String[] args) {
    String bosted=""; //Variable
    String navn=""; //Variable

    Scanner in = new Scanner(System.in);

    System.out.println("Skriv inn navn: "); //What shows up when you first start the program

    while(in.hasNext()) { //Only allow letters A-Z
         navn = in.nextLine();
        if(!navn.isEmpty() && navn.matches("[A-Za-z]+")){
             System.out.println("Takk!"); //Says thank you if the user has entered letters
             in.next();
             break;
        }
        else{
            System.out.println("Tall horer ikke hjemme i navn, prøv igjen!"); //Prints, "numbers dont belong in names, try again" if what the user entered is a number
            in.next();
            System.out.println("Skriv inn navn: ");
            continue;
        }

  }

    System.out.println("Skriv inn bosted: ");
    while(in.hasNext()) { //Only allow letters A-Z
        bosted = in.nextLine();
       if(!bosted.isEmpty() && bosted.matches("[A-Za-z]+")){
         System.out.println("Takk!"); //Says thank you if the user has entered letters
         break;
       }
       else{
           System.out.println("Tall horer ikke hjemme i navn, prøv igjen!"); //Prints, "numbers dont belong in names, try again" if what the user entered is a number
           in.next();
           System.out.println("Skriv inn bosted: ");
           continue;
       }


 }
    System.out.println("Hei, " + navn + "! Du er fra " + bosted + "."); //Prints out what the user has entered previously in a full sentence.
}  

1 个答案:

答案 0 :(得分:21)

很简单:代码中有很多断开的链接。 例如,您尝试包含名为js/navScroll.js的脚本,但实际上该文件名为js/navscroll.js

每个损坏的链接都会导致重定向到000webhost的404错误页面,这是一个HTML文档,因此以<开头。

浏览器期待CSS或JS文件,抱怨意外的令牌。