我目前有一个联系人表单,完成后会触发浏览器警报/弹出,但我希望弹出的样式更像一个模式。因此,弹出窗口将集中在页面上&在页面上覆盖一个黑暗透明的背景,点击后就会褪色--这有可能吗?
下面是我当前触发弹出警报的脚本:http://jsfiddle.net/xf4C6/
function fcheckf(){
var x = document.getElementById('check').value;
if(x == 0)
{
return false;
}
else
{
alert("Your message has been sent! Thank you for getting in touch.");
}
}发布于 2014-05-01 22:15:17
Oki doki这里是我的答案:
<div id="popup" style="width:250px;height:250px;background-color:rgba(255,255,255,0.5);border:3px solid black;display:none;z-index:999;position:absolute;top:50%;left:50%;margin-left:-125px;margin-top:-125px;">
<div style="width:230px;height:230px;margin-left:10px;margin-top:10px;background-color:#FFFFFF;">
Thank you for submitting your details<p>
<div onclick="document.getElementById('popup').style.diplay='none';" style="margin-left:auto;margin-right:auto;width:75px;height:30px;background-color:#000000;cursor:hand;">
Close
</div>
</div>
</div>Javascript
变化
alert("Your message has been sent! Thank you for getting in touch.");至
document.getElementById("popup").style.display="block";发布于 2014-05-01 22:42:36
可以使用jquery对话框。
https://stackoverflow.com/questions/23417498
复制相似问题