JS三种消息框的使用

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>window对象的三种提示框</title>
<script type="text/javascript">
//确认框使用方法
function ww() {
var re = confirm("确认退出?");
if(re == true) {
alert("你选择了确定"); //提示框
} else {
alert("你选择了取消");
}
}
//ww();
//提示用户输入信息的框
var name = prompt("请输入名字","QQQ");//默认值是QQQ
alert(name); </script>
</head>
<body>
<a href="History对象.html">下去</a>
</body>
</html>

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOsAAACMCAIAAAASmclgAAAGnUlEQVR4nO3dv3KbSBzA8X0fPEORZ4GOl0iPXPMIKW4sIZdX0KaU5NRuVLh0k5xk5Lubm0nNFfxbYCVjexnxg+9nmNhCYIH4ar3SzSUqAyRT1z4A4FMoGLJRMGSjYMhGwZCNgiEbBUM2CoZsFAzZKBiyUTBko2DIRsGQjYIhGwVDNgqGbBQM2SgYslEwZKNgyEbBIuwj14321z6KUaLgShIESXuNaq/K9pHbWLePXKWUIa995Hb3Njyoad/PbDg3FFzLB7o8ya6inySoQtpHbrk6CZQh17dGziS4+EDGw6i8/eqYBwrW7aNAL641Brfbdl39dhAE3bH4bMP5z2pXqG+uvVSMu1NwjoI7zgzCQZLf57rvmJImgWm03Edu3nqjUtM8wTgQM5vQUXCuyLYZR2cevI/cIMrHybrzch/DuJgEqtz+jGL6YZ6FmI+SwbeBgjVJ4EbJmWmwUm6URG7xx776hZ8EbrRPgnwC3eldBYn5DWFjo35Vkq8RBWvKX+qdKWixQvud7gaBNgYbC65nBebZ8Lm3am60PzuVYTLRQcGauuALuez7jcHNeUFzGM5/vnlCfe4N3MWBfM4oWPPWGJxlWT1jdi+Nwd13Zd0150ZmCn4XCtYkgRtFgRtF5jG4+s3eGYOzLKvfyZ2br1afQGi3+88OKPgMCq5V6b01BpcF53Ph4qOEor2L/+2sEXHPMbia0hCwEQUb1BWV+fCuabQoGLJRMGSjYMhGwZDNTsH+Hz9ZWD6wfL49awVb+TmYlfEW/OXbIA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EdAwJ6HjRNkkh+L8Znyg6XrRNUvwjFB2vyCYp/haKjleEjkei40XbJMVfQtHxitDxSHS8aHQ8Eh0v2iYp/nyWH6EKfwws/3X/MrzCY+h4RTZJkc/jY/+iauExz4+h0oTHzkoOL/uPmfYmz3M6XpH5Os7zPM8/9i/hUfua53l+DFXz/cf+pb/VY0jHuM+8HX/sw/1Hnh/DlzDsDLyzRjoCHa/IJimusznUU4nwcNp53u50vZ52Xni4Xq/l5dPOG5pWKOXtTrPtDR2vyCYpPmdyCJRSweHzEKjg4CjW253sm5x2XnCY6/5tdLwis3V82nlBEOgde7tTW2p9uV71YH33BHS8IjOOx59lwTfHYy1pay3HiP0AOl6RTVJcZvMWqODt8haoYLv1vO3Py+Xyc+sFb+XX8orLW6CUCt4uF23pU9DximyS4jyb16AeWD3P276fz+fz+9YLXsuv3vb9fH4NlLd9fw2U8rbvzdKnoOMVmbvjOto6z/etF2y3nlJKBa/NCtXKDjNmTccrMmvHy0LHK7JJij+EouMVoeOR6HjRNknx1f/njWeh4xWh45HoeNE2SfGbUHS8InQ8Eh0v2pf/Uyn8OyzA/4eOIQEdQwI6hgR0DAnoGBLQMSSgY0hAx5CAjiEBHUMCOoYEdAwJ6BgS0DEk+A+R8dxnOtIIjwAAAABJRU5ErkJggg==" alt="" />

注意:

JS的prompt()可以带两个参数,第一个为提示,第二个可以设置默认值。

  用户输入之后如果点击取消返回值为null。

例如:

function updateBiaoduan(obj){
var projectName=$(obj).parent().parent().children("td:eq(1)").text();
var name = prompt("请输入标段名字",projectName);
if(name!=null){//点击确定
alert(name)
}
}
上一篇:mysql InnoDB index 主键采用聚簇索引,二级索引不采用聚簇索引


下一篇:在Dynamics 365中使用SURVEYJS代替对话(Dialog)制作话术