📜  html代码示例中的随机数文本

📅  最后修改于: 2022-03-11 14:53:31.254000             🧑  作者: Mango

代码示例2
function RandomID() {
  var value;
  var rnd = Math.floor(Math.random() * 11);

  if (rnd === 7)
    value = "Wassup";
  else if (rnd <= 5)
    value = "Hello";
  else
    value = rnd;

  document.getElementById('id').value = value;
}