1.document.write(" ") 如下例:
document.write("<p>This is a paragraph</p>");
把引号内的html写到网站上。您只能在 HTML 输出中使用 document.write。如果您在文档加载后使用该方法,会覆盖整个文档。
2. 弹出alert(),多用于测试。
onclick="alert('Welcome!')"
x=document.getElementById("demo") //查找元素 x.innerHTML="Hello JavaScript"; //改变内容