Html彈出窗口我試圖在提交特定窗體時向客戶顯示一個花哨的html彈出框/框架(不是windows樣式)。不知道什麼是最好的做法!Html彈出窗體提交
我嘗試了下面的代碼,但有2個問題。首先,彈出框看起來像一個我不想要的Windows彈出框(瀏覽器類型)。我只想要一個簡單的方框,我可以添加顏色,圖像等。另一個問題是,我的代碼中的鏈接不起作用。例如。我想讓其中一個鏈接在關閉消息框後將我帶到網站上的另一個頁面,而另一個鏈接可以簡單地用於關閉該框......或者可能只是2個鏈接,可以將我帶到2個不同的頁面!
<form action="do.something" method="post" onsubmit="return action_submitted();">
<script type="text/javascript">
function action_submitted() {
HTML = '';
HTML += '<html><head><title>New Action</title></head>';
HTML += '<body bgcolor="#f5f5f5" style="margin:0px;">';
HTML += 'Congrats, your action was successful! <br/>';
HTML += '<a href="close">Close Message</a><br/>';
HTML += '<a href="/gothere.do">There</a><br/>';
HTML += '<script>onload=function(){setTimeout("self.close()",5000);}<'+'/script>';
HTML += '</body></html>';
var w = 500;
var h = 200;
var l = (screen.availWidth - w)/2;
var t = (screen.availHeight - h)/2;
actionwin = open('javascript:opener.HTML','actionwin','left='+l+',top='+t+',width='+w+',height='+h+',status=0');
if (actionwin && !actionwin.closed) actionwin.focus();
return true;
}
</script>
請幫助:)
非常感謝!
這樣的彈出式窗口通常稱爲模式對話框或類似窗口。您可以在Google中找到很多插件。我在http://www.ericmmartin.com/projects/simplemodal/之前使用過這個 – elclanrs 2012-04-19 06:15:38