innerHTML在chrome中显示空白

时间:2015-05-31 14:47:27

标签: javascript google-chrome

我想获取 textarea [ textBox ]的用户输入文本并将其放在 p [ cParagraph < /强>] 它在IE上工作但不在Chrome上工作

function toggleOverlay(){
  var overLay = document.querySelector("#overlay"),
      modal = document.querySelector("#modal"); 

  if(overLay.style.display !== "block" || modal.style.display !== "block"){
  overLay.style.display = "block";
  modal.style.display = "block";
    }else {
        overLay.style.display = "none";
        modal.style.display = "none";
    }
}

function submitMsg() {
  var cHeader = document.querySelector(".cHeader"),
      cParagraph = document.querySelector(".cParagraph"),
      userName = document.querySelector("#userName"),
      textBox = document.querySelector("#textBox");
  cParagraph.innerHTML = textBox.innerHTML;
  cHeader.innerHTML = userName.value;
  toggleOverlay();  
}
document.querySelector("#post").addEventListener("click", toggleOverlay,false);
document.querySelector("#submit").addEventListener("click", submitMsg, false);

0 个答案:

没有答案