cef/tests/cefclient/res/modalmain.html
Marshall Greenblatt 02d6f3e384 Add support for modal dialogs (issue #250).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@255 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2011-06-14 15:09:55 +00:00

58 lines
1.1 KiB
HTML

<!doctype html>
<html>
<head>
<title>Test Modal Dialog</title>
</head>
<body>
<h3>Test Modal Dialog</h3>
Click this <button onclick="doModal()">button</button> to open a modal dialog.
<h3>Time (timers are suppresed while the modal dialog is open)</h3>
<div id="time"></div>
<h3>Result Log</h3>
<div id="result"></div>
<script>
function init()
{
timer();
setInterval(timer, 200);
}
function timer()
{
updateId("time",new Date().toLocaleString());
}
function updateId(id, html, append)
{
id = document.getElementById(id);
if (typeof html == "boolean")
html = html?"Yes":"No";
if (append)
id.innerHTML += html + '<br>';
else
id.innerHTML = html;
}
function doModal()
{
updateId('result', "Modal dialog is open...", true);
var result = window.showModalDialog("http://tests/modaldialog", { msg:"Hi from parent"} );
if (typeof result == "object") {
updateId('result', "Result: " + result.msg, true);
} else {
updateId('result', "Dialog was closed", true);
}
}
window.addEventListener('load', init, false);
</script>
</body>
</html>