JavaScript show modal dialog

Index.html:

<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? \n  Answer: "+ret);
				}
    </script>
	</head>
	<body>
		<input type="button" value="Show Modal Dialog" onclick="show();"/> 
	</body>
</html>

sub.html:

<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>

  

相关推荐