Javascript 埃瓦兰斯沃形式的变节

Javascript 埃瓦兰斯沃形式的变节,javascript,html,Javascript,Html,这里的英语老师正在努力使一个语法小部件工作 我需要能够在我的答案中包含撇号。每当我输入一个,将其变为绿色或红色的功能都不起作用 下面是我尝试做的一个例子: <!DOCTYPE html> <html> <head> <title>Connect</title> <style> form{font-family:"Verdana";font-size:18px;} input{font-family:"Verdana";fon

这里的英语老师正在努力使一个语法小部件工作

我需要能够在我的答案中包含撇号。每当我输入一个,将其变为绿色或红色的功能都不起作用

下面是我尝试做的一个例子:

<!DOCTYPE html>
<html>
<head>
<title>Connect</title>
<style>
form{font-family:"Verdana";font-size:18px;}
input{font-family:"Verdana";font-size:18px;}
button{font-family:"Verdana";font-size:18px;font-          
weight:bold;background:blue;color:white;box-shadow: 10px 10px 5px #888888;border:none}
</style>
</head>
<body>
<form> 
1. Parkour is an athletic discipline <input id="1" type="text" placeholder="that / which /     
who"/> developed from obstacle course training.  
<p>
2. Athletes <input id="2" type="text" placeholder="that / which / who"/> come from all     
over the world, will meet at the XGames next month. 

<p>
<p>

<button type="button"         
onclick="evalAnswer('1','that','which');evalAnswer('2','who')">CHECK</button><br> 

<!-- If you need a new sentence, now you just need to increment the id's number and -->
<!-- change the button: ...onclick="evalAnswer('5','may','can','should')... -->
<!-- note that you can add more than one right answer -->

<!-- Example: -->
<!-- 6. You <nbsp&><input id="6" type="text" /> to see a doctor! -->
<!-- <button type="button" onclick="evalAnswer('6','have 
to','need','should')">CHECK</button> -->
</form>
<script>
function evalAnswer() {
var id = arguments[0];
var answer = document.getElementById(id).value;
for (var i = 1; i < arguments.length; i++) {
if(arguments[i] == answer ){
document.getElementById(id).style.color = "green";
break;
} else {
document.getElementById(id).style.color = "red";
}
}
}
</script>
</script>
</body>
</html>

连接
表格{字体系列:“Verdana”;字体大小:18px;}
输入{字体系列:“Verdana”;字体大小:18px;}
按钮{字体系列:“Verdana”;字体大小:18px;字体-
重量:粗体;背景:蓝色;颜色:白色;方框阴影:10px 10px 5px#88888;边框:无}
1.跑酷是从障碍训练发展而来的一门运动学科。

2.运动员来自世界各地
在世界各地,我们将在下个月的XGames上会面。


检查
函数evalAnswer(){ 变量id=参数[0]; var answer=document.getElementById(id).value; for(var i=1;i
您可以通过在撇号前面添加反斜杠
\
来避开撇号

onclick="evalAnswer('1','that\'s','which');evalAnswer('2','that\'s')"