浏览器警报样式 [英] Browser Alert Styling
本文介绍了浏览器警报样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前有一个联系表单,当完成时触发浏览器警报/弹出窗口,但我想风格的弹出窗口更像一个模态。所以弹出窗口将以中心&
I currently have a contact form that when completed triggers a browser alert/popup but i would like to style the popup to be more like a modal. So the popup would be centred & overlaid on the page with a dark transparent background that fades away when clicked - is this possible?
这是我当前的脚本触发弹出警报: http://jsfiddle.net/xf4C6/
Here is my current script triggering the popup alert: 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.");
}
}
推荐答案
doki heres my answer:
Oki doki heres my answer:
HTML
<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";
这篇关于浏览器警报样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文