Php onClick不使用';a';要素

Php onClick不使用';a';要素,php,javascript,html,function,onclick,Php,Javascript,Html,Function,Onclick,我在css中有两个独立的类,我希望链接在单击时从一个类切换到另一个类。我甚至没有收到警报,因此我认为onClick部分有问题: <script type="text/javascript"> function find(word) { alert('check'); if (document.getElementById(word).className == "remaining";) { document.getElem

我在css中有两个独立的类,我希望链接在单击时从一个类切换到另一个类。我甚至没有收到警报,因此我认为
onClick
部分有问题:

   <script type="text/javascript">
     function find(word) {
       alert('check');
       if (document.getElementById(word).className == "remaining";) {
         document.getElementById(word).className = "found";
       } else {
         document.getElementById(word).className = "remaining";
       };
     };
   </script>
[...]
<a href="#" id="word20" class="remaining" onClick="find('word20');">LOL</a>

函数查找(word){
警惕(“检查”);
if(document.getElementById(word).className==“剩余的”;){
document.getElementById(word).className=“found”;
}否则{
document.getElementById(word).className=“剩余”;
};
};
[...]
提前谢谢

if (document.getElementById(word).className == "remaining";) {
------------------------- E R R O R ----------------------^
这里的假分号就是错误

我在FirefoxJavaScript的错误控制台中发现了错误。使用Ctrl+Shift+J可以轻松启动它

这里的假分号就是错误


我在FirefoxJavaScript的错误控制台中发现了错误。使用Ctrl+Shift+J启动它很容易。

如果出现sintax错误,脚本应如下所示:

<script type="text/javascript">
 function find(word) {
   alert('check');
   if (document.getElementById(word).className == "remaining") {
     document.getElementById(word).className = "found";
   } else {
     document.getElementById(word).className = "remaining";
   };
 };

函数查找(word){
警惕(“检查”);
if(document.getElementById(word).className==“剩余”){
document.getElementById(word).className=“found”;
}否则{
document.getElementById(word).className=“剩余”;
};
};


删除该文件;在“剩余”旁边,您有一个sintax错误,脚本应该如下所示:

<script type="text/javascript">
 function find(word) {
   alert('check');
   if (document.getElementById(word).className == "remaining") {
     document.getElementById(word).className = "found";
   } else {
     document.getElementById(word).className = "remaining";
   };
 };

函数查找(word){
警惕(“检查”);
if(document.getElementById(word).className==“剩余”){
document.getElementById(word).className=“found”;
}否则{
document.getElementById(word).className=“剩余”;
};
};

删除该文件;“剩余”旁边