A user writes 'football' into my input bar and then the action on line 6 and 7 executes.(用户将“足球”写入我的输入栏中,然后执行第6行和第7行的操作。)
var input = document.getElementById("user_input"); let footballTeams = ["Manchester","Barcelona","Copenhagen"] if (input.value == "football") { alert("These cities have football teams:" + " " + footballTeams[0] + "," + " " + footballTeams[1] + "," + " " + footballTeams[2])
尝试这个:
if (input.value.toLowerCase() == "football")
1.4m articles
1.4m replys
5 comments
57.0k users