怎样实现点击按钮出现alert警告?

来源:百度知道 编辑:UC知道 时间:2024/05/23 19:40:01
在支持javascript的回帖论坛中,我想在回帖的时候制作一个按钮,点击以后出现alert内容。

你参照如下代码即可:

点击按钮弹出:I am an alert box!!

<html>
<head>
<script type="text/javascript">
function display_alert()
  {
  alert("I am an alert box!!")
  }
</script>
</head>
<body>

<input type="button" onclick="display_alert()"
value="Display alert box" />

</body>
</html>

<input type="button" value = "点击" onclick="alert('123123')" />