返回原件状态的其他返回不起作用

Eri*_*rik 1 javascript if-statement

我更改背景颜色的代码效果很好,但"else"返回不起作用.我错过了什么吗?这是我有的:

<script type="text/javascript">
$(document).ready(function() {
  var input = document.getElementById("test");

  input.onclick = function ()
  {
    document.getElementById("quote_input").style.backgroundColor = "#AAB3AA";
    document.getElementById("test").style.backgroundColor = "#AAB3AA";

    else {
      document.getElementById("quote_input").style.backgroundColor = "#000";
      document.getElementById("test").style.backgroundColor = "#000";

    }  
  };
});
</script>
Run Code Online (Sandbox Code Playgroud)

Ed *_*ess 5

先生,除非我弄错了,否则你错过了IF声明.