confirm的用法。

本文展示了一个简单的HTML页面如何使用内联JavaScript实现链接点击确认框功能。通过两个连续的确认对话框,演示了如何根据用户的输入进行不同的网页操作。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        a
        {
             border-style:solid;
             border-color:#cccccc;
             border-width:1px;
             padding:2px;
             margin:0px;
             color:Black;
             font-size:smaller;
             background-color:#eeeeee;
             text-decoration:none;
             font-family:@新宋体;
             
             
            }
            
    </style>

    <script type="text/javascript">
        function con() {
            if (confirm("你确定要联系我们吗?")) {
                //window.location.href = 'http://www.baidu.com';
                //location.href = "http://www.baidu.com";
                //window.open('http://www.baidu.com');
                if (confirm("能不能不联系我们啊?") == true) {
                    return;
                }
                else {
                    window.open("http://www.baidu.com");
                }

            }
            else {
                return;
            }
        }
    </script>
</head>
<body>
<a href="#" onclick="con()">联系我们</a>
</body>
</html>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值