JS中confirm,alert,prompt的用法
2010-3-6 杜世伟 JavaScript
window.confirm 参数就只有一个.显示提示框的信息.
按确定,返回true; 按取消返回false.
<script>
var bln = window.confirm("确定吗?");
alert(bln)
</script>
window.alert参数,只有一个,显示警告框的信息;
无返回值.
<script>
window.alert("确定.")
</script>
window.prompt参数,有两个,
第一个参数,显示提示输入框的信息.
第二个参数,用于显示输入框的默认值.
返回,用户输入的值.
<script>
var str = window.prompt("请输入密码","password")
alert(str);
</script>
热门日志
分类
- Django(4)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(32)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- about(1)
- git(9)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(2)
- 架构(18)
- Vue(1)
- game(2)
- Html(6)
- Java(8)
- Mysql(37)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(72)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Php(102)
- Windows(8)
- Message(48)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(12)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)