
Untitled
By: a guest on
May 27th, 2012 | syntax:
None | size: 1.33 KB | hits: 14 | expires: Never
simple jquery alert window
<input type = "button" value="show alert">
<script>
$("input").click(function(){
)};
</script>
<input type="button" id="redirect" value="show alert" />
<div id="alertWindow">
You'll be redirect to google.com. Continue?
<br /><br />
<input type="button" id="btnOk" value="OK" /> <input type="button" id="btnCancel" value="Cancel" />
</div>
#alertWindow {
display: none;
text-align: center;
border: 1px solid #333;
width: 200px;
height: 80px;
border-radius: 5px;
padding: 10px;
}
#btnOk, #btnCancel { width: 70px; }
$(function() {
$("#redirect").click(function(){
$('#alertWindow').show();
return false;
});
$('#btnCancel').click(function() {
$('#alertWindow').hide();
});
$('#btnOk').click(function() {
location.href = 'http://www.google.com';
return false;
});
});
<input type = "button" value="show alert">
<script>
$("input").click(function(){
$("#myDiv").dialog({
buttons: {
"OK": function() {
window.location.href = //my url
},
"Cancel": function() {
this.dialog("close");
}
})
//put all your other dialog options here
});
)};
</script>