JavaScript show modal dialog

1523 ワード

Index.
 
<html>
	<head>
    <script anguage="javascript">
				function show() {
					var settings="dialogWidth:245px;dialogHeight:390px;resizable:no;status:no";
					var ret = window.showModalDialog("sub.html","",settings);
					 
					alert("Question: What are you clicked in modal dialog? 
Answer: "+ret); } </script> </head> <body> <input type="button" value="Show Modal Dialog" onclick="show();"/> </body> </html>
 
 
sub.
<html>
	<head>
		<script language="javascript">
			
				function done() {
				 
				  window.returnValue=" You are clicked done.";
				  window.close();
				}
				
				function cancel() {
					  
				   	window.returnValue=" You are clicked cancel.";
				   	window.close();
				}

		</script>
	</head>
	<body>
		<input type="button" value="Done" onclick="done();"/>
		<input type="button" value="Cancel" onclick="cancel();"/>
	</body>
</html>