confirg
在用户点击确定按钮或取消按钮把对话框关闭之前,它将阻止用户对浏览器的所有输入。在调用 confirm() 时,将暂停对 JavaScript 代码的执行,在用户作出响应之前,不会执行下一条语句。
下面我们通过这两个小例子,来了解一下它的使用方法吧:
复制代码 代码如下:
<html>
<head>
<title>confrim 的使用方法</title>
<script type="text/javascript">
function clear1()
{
if(confirm("确定要清空数据吗?"))
{
document.main.text1.value="";
}
}
</script>
</head>
<boty>
<form name="main">
<input type="text" name="text1"/>
<input type="button" name="submit" value="数据清空" onclick="return clear1()"/>
</form>
</body>
<
ml>
<html>
<head>
<title>js confirm</title>
<script>
function begin()
{
var a=confirm("郭杨和小代是好朋友吗?");
if(a==true)
{
/*document.write("恭喜你答对了!");*/
alert("恭喜你答对了!");
begin();
}
else
{
/*document.write("你真是猪,这么简单的问题都答不对!");*/
alert("你真是猪,这么简单的问题都答不对!");
begin();
}
}
</script>
</head >
<body onload="begin()">
</body>
<
ml>
confirg的更多相关文章
随机推荐
- Helpers.parallel_bulk in Python not working?
Helpers.parallel_bulk in Python not working? 学习了:https://discuss.elastic.co/t/helpers-parallel-bulk- ...
- 如何使用Apache设置404页面
方法一:[.htaccess文件配置404] 网上大部分解决办法是:首先你要开启Apache的rewrite_module模块,支持.htaccess,然后在网站根目录建立.htaccess文件(或已 ...
- Android双向seekbar
※效果 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/disso ...
- 关于Future.cancel(mayInterruptIfRunning)方法的参数的问题
mayInterruptIfRunning设成false话,不允许在线程运行时中断,设成true的话就允许. 可以参考下面的代码来理解,如果设为false的话,会打印到99999,如果设成true的话 ...
- SchemaExport
不在xml中配置 <!-- Drop and re-create the database schema on startup <property name ...
- iOS 移动端生成工具开发
代码地址如下:http://www.demodashi.com/demo/11284.html 一.准备工作 编译环境 xcode 用于生成冗余架构代码, 实现生成零耦合架构 二.程序实现 上个月的一 ...
- iOS-格式化金额,三位一逗号
代码地址如下:http://www.demodashi.com/demo/11244.html 项目版本更新迭代中, 新增需求: 所有金额必须用标准会计表示方式(¥94,862.57). 而之前金额展 ...
- PHP-PHP5.3及以上版本中检查json格式的方法
function is_json($string) { json_decode($string); return (json_last_error() == JSON_ERROR_NONE); } j ...
- Struts2中防止表单重复提交,global-results定义全局结果处理
1.在表单中加入<s:token/>标签 2.在动作类中加入token的拦截器 <!--如果单单写 name="token" 会丧失 defaultStack 拦 ...
- SUSE11SP3--安装svn
SUSE上安装新版本的subversion是一件很麻烦的事情,涉及到的依赖太多,包括需要更新部分工具的版本. 为了以较小的代价安装subversion,我决定在SUSE11下安装 subversion ...