Google Chrome浏览器不支持该功能

Google Chrome does not support function

本文关键字:功能 不支持 浏览器 Chrome Google      更新时间:2023-09-26

我有一个不能在Google chrome上运行但在IE上成功运行的函数的问题。我真的需要它在Chrome上运行。

function SubmitForm(){
 if(textbox2.value=="OFFERED RATE"){
    alert(" C o n g r a t u l a t i o n s ! 'n You are absolutely CORRECT");
    location.href='list_quiz.html';
}else
alert("Sorry, You are WRONG.'n The correct answer is OFFERED RATE");
    location.href='list_quiz.html';
}
<button onclick="SubmitForm()">Submit New</button>

请帮助解决问题。

谢谢。

试试这个:

HTML文件

<button id="submit_form">Submit New</button>

JAVASCRIPT文件

button = document.getElementById('submit_form')
button.addEventListener("click", SubmitForm, false);

然后您还必须更改SubmitForm()函数以获得textbox2值,如下所示:

answer = document.getElementById('textbox2').value
if (answer=="OFFERED RATE"){
...
}