为什么这个JavaScript没有';不行?

为什么这个JavaScript没有';不行?,javascript,internet-explorer,google-chrome,mozilla,Javascript,Internet Explorer,Google Chrome,Mozilla,这是我的代码: function habilitarsistemas() { if (document.getElementById("ChkSistemas").checked) document.getElementById("tabelasistemas").style.display = "block"; else document.getElementById("tabelasistemas").style.display = "none

这是我的代码:

function habilitarsistemas() {
    if (document.getElementById("ChkSistemas").checked)
        document.getElementById("tabelasistemas").style.display = "block";
    else
        document.getElementById("tabelasistemas").style.display = "none";
}
它在Firefox上运行良好,但在IE和Chrome上则不行。为什么?

jQuery解决方案

function habilitarsistemas() {
  if ($('#ChkSistemas').is(':checked')) {
    $('#tabelasistemas').css({ display: 'block' });
  }
  else {
    $('#tabelasistemas').css({ display: 'none' });
  }
}

它可能与只提供@name属性而不提供@id的HTML标记有关吗?
(有一个从@name到@id的传统映射,但Chrome不支持它。)

因为它有错误。你能为@user3042318解释一下为什么这个代码比他的好吗?它有正确的开始和结束,它是jQuery,我不是说它更好;)脚本JQuery envirado pelo mdesdev porém não functiono vo postar a part do código onde se encontra a tabel aparencement ele não rechece e esse id.Obrigado a todos as eu consegui acenas colocando as as as as as as as not if e els of the almotive vo ou nãsei o javascript tem isso apenas um um um um in a in a a a a a charve a a a a a a a a a a a a a charve今天是今天!Porque no meio,Caço feliz;)