要做一种 点击按钮 第一次弹出一个提示框提示“失败”点确定后返回本页面
再次点击按钮 提示“成功” 并返回首页面 该怎么做呢

解决方案 »

  1.   

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    function add(){
    var div=document.createElement("div");
    var style={
    'position':'absolute',
    'left':'0px',
    'top':'0px',
    'width':'100%',
    'height':'100%',
    'opacity':'.5',
    'filter':'alpha(opacity=50)',
    'backgroundColor':'black'
    }
    for(var i in style){
    div.style[i]=style[i];
    }
    document.body.appendChild(div);
    var dial=document.createElement("div");
    var style={
    'position':'absolute',
    'left':'100px',
    'top':'100px',
    'width':'400px',
    'height':'400px',
    'backgroundColor':'blue'
    }
    for(var i in style){
    dial.style[i]=style[i];
    }
    document.body.appendChild(dial);
    var cancel=document.createElement("input");
    cancel.type='button';
    cancel.value="取消";
    cancel.onclick=function(){
    var p=div.parentNode;
    p.removeChild(div);
    p.removeChild(dial);
    }
    dial.appendChild(cancel);
    var sure=document.createElement("input");
    sure.type='button';
    sure.value="确定";
    sure.onclick=function(){
    window.location.href='http://www.baidu.com';
    }
    dial.appendChild(sure);
    }
    </script>
    </head><body>
    <input type="button" value="弹出对话框" onclick="add()">
    </body>
    </html>
    类似这样试试
      

  2.   

    你可以通过jquery ui 的dialog去实现