<html>
<head>
<title></title>
<script type="text/javascript">
<!--
function onLoad() {
document.getElementById("status").onchange = confirmApproved;
}
function confirmApproved() {
var e = document.getElementById("status");
if (e.options[e.selectedIndex].value == "Approved") {
if (confirm("Please read the terms and conditions and click OK! More text....")) {
// do soemthine
} else {
// don't do it
}
}
}
//-->
</script>
</head>
<body onload="onLoad()">
<form name="editor" method="post" action="Send.asp">
<select id="status" name="Status" onchange="confirmApproved">
<option value=""></option>
<option value="Pending Approval">Pending Approval</option>
<option value="Approved">Approved</option>
<option value="Disapproved">Disapproved</option>
</select>
<input type="Submit" name="Submit" value="Submit" />
</form>
</body>
</html>
ASKER
<!DOCTYPE html>
<html>
<head>
<link data-require="jqueryui@1.10.0" data-semver="1.10.0" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.0/css/smoothness/jquery-ui-1.10.0.custom.min.css" />
<script data-require="jquery@2.1.4" data-semver="2.1.4" src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script data-require="jqueryui@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.0/jquery-ui.js"></script>
<link rel="stylesheet" href="style.css" />
<script>
$(document).ready(function() {
$("#status").change(function() {
if ($(this).val() == "Approved") {
$( "#msgPopup" ).dialog({
resizable: false,
height:340,
modal: true,
buttons: {
"Agree": function() {
$('input[type="submit"]').prop('disabled', false);
$( this ).dialog( "close" );
},
Cancel: function() {
$('input[type="submit"]').prop('disabled', true);
$( this ).dialog( "close" );
}
}
});
} else {
// Enable submit button again
$('input[type="submit"]').prop('disabled', false);
}
});
});
</script>
</head>
<body>
<h1>EE Q</h1>
<form name="editor" method="post" action="Send.asp">
<select id="status" name="Status">
<option value=""></option>
<option value="Pending Approval">Pending Approval</option>
<option value="Approved">Approved</option>
<option value="Disapproved">Disapproved</option>
</select>
<input type="Submit" name="Submit" value="Submit" />
</form>
<div id="msgPopup" title="Just a demo modal message" style="display:none">
<p>
<span style="color:red;font-weight:bold">Experts-Exchange Confirm</span><br/><br/>
<span>Do you agree that this is a viable solution?</span>
</p>
</div>
</body>
</html>
ASKER
ASKER
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.
TRUSTED BY
the quickest one would be the usage of jQuery and jQuery UI.
Demo here: jQuery UI Modal Dialog Message
The div containing the dialog text contains plain HTML therefore you can write and style however you want.
KR
Rainer