小编Rya*_*ung的帖子

为什么这个 document.innerHTML 函数不起作用?

我不知道为什么如果你触发该功能,什么也没有发生

loginButton.addEventListener("click", function() {
  const password = document.getElementById("password").value;

  if (password === "password") {
    alert("Correct!");
    document.innerHTML = <embed src="http://stackoverflow.com" style="width:500px; height: 700px;"></embed>;
  } else {
    loginMessage.textContent = "Invalid password.";
  }
});
Run Code Online (Sandbox Code Playgroud)

我期待嵌入一个网站

html javascript if-statement function

1
推荐指数
1
解决办法
71
查看次数

标签 统计

function ×1

html ×1

if-statement ×1

javascript ×1