Hi Guys,
I was facing a problem with JavaScript confirm box with push notification timer. There is no way to close the JavaScript confirm box programatically. I have created my own confirm box using html and JavaScript which is also easy to handle and customizable.
Here is the HTML and JavaScript code for the same.
<div id="notificationpopup" style="left:0;top:0;position:fixed;width:100%;height:100%;background-color:#000;opacity:0.6">
<div id="popup" style="margin-top:50%;background-color:yellow">
<div id="header">
<h2>Please Confirm</h2>
</div>
<div id="popupbody">
<div>Do you want to accept?</div>
<div>
<input type="button" value="Yes" onclick='dialog(1)'>
<input type="button" value="No" onclick='dialog(2)'>
</div>
</div>
</div>
</div>
<script src="js/jquery.1.7.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function dialog(response)
{
if(response==1)
alert("You Clicked Yes");
else
alert("You Clicked No");
}
</script>
Thanks
Ritesh
I was facing a problem with JavaScript confirm box with push notification timer. There is no way to close the JavaScript confirm box programatically. I have created my own confirm box using html and JavaScript which is also easy to handle and customizable.
Here is the HTML and JavaScript code for the same.
<div id="notificationpopup" style="left:0;top:0;position:fixed;width:100%;height:100%;background-color:#000;opacity:0.6">
<div id="popup" style="margin-top:50%;background-color:yellow">
<div id="header">
<h2>Please Confirm</h2>
</div>
<div id="popupbody">
<div>Do you want to accept?</div>
<div>
<input type="button" value="Yes" onclick='dialog(1)'>
<input type="button" value="No" onclick='dialog(2)'>
</div>
</div>
</div>
</div>
<script src="js/jquery.1.7.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function dialog(response)
{
if(response==1)
alert("You Clicked Yes");
else
alert("You Clicked No");
}
</script>
Thanks
Ritesh
No comments:
Post a Comment
Comments are welcome, Please join me on my Linked In account
http://in.linkedin.com/pub/ritesh-tandon/21/644/33b