<head>
<script type="text/javascript">
function disp_alert()
{
alert("我是警告框!!")
}
</script>
</head>
<body><input type="button" onclick="disp_alert()" value="显示警告框" /></body>
</html>
确认框的例子:<html>
<head>
<script type="text/javascript">
function show_confirm()
{
var r=confirm("Press a button!")
if (r==true)
{
alert("You pressed OK!")
}
else
{
alert("You pressed Cancel!")
}
}
</script>
</head>
<body><input type="button" onclick="show_confirm()" value="Show a confirm box" /></body>
</html>
<input id="content" type="text" /><input type="button" id="btn" value="ok" onclick="show()">
<script>
function show()
{
var oText=document.getElementById("content")
var oP =document.createElement("p")
oP.innerHTML=oText.value
document.body.appendChild(oP)
}
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)