View Single Post
  #25 (permalink)  
Old May 26th, 2005, 05:34 AM
ChrisScott ChrisScott is offline
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Save this as alert.htm...
Code:
<html>

<head>
<style type="text/css">
body{
    background-color: buttonface;
    overflow: hidden;
}
body, input{
    text-align: center;
    font-size: 8pt;
    font-family: MS Sans Serif;
}
input{
    height: 23px;
    width: 75px;
}
#myMessageDiv{
    padding: 15px;
}
</style>
<script type="text/javascript" language="javascript">
function Init(){
    document.getElementById("myMessageDiv").appendChild(document.createTextNode(window.dialogArguments));
}
function returnOk(){
    window.returnValue = true;
    window.close();
}    
</script>
</head>

<body onload="Init();">
<div id="myMessageDiv"></div>
<input type="button" value="OK" onclick="returnOk();" />
</body>

</html>
then in your page where you want to show it just add...
Code:
showModalDialog('alert.htm', 'my message', 'dialogWidth: 200px; dialogHeight: 120px; help: no;')
(you will need to adjust width / height depending on your message)

Reply With Quote