| 1 |
<!doctype html> |
| 2 |
<html> |
| 3 |
<!-- |
| 4 |
Copyright 2010 The Closure Library Authors. All Rights Reserved. |
| 5 |
|
| 6 |
Use of this source code is governed by the Apache License, Version 2.0. |
| 7 |
See the COPYING file for details. |
| 8 |
--> |
| 9 |
<head> |
| 10 |
<title>goog.ui.Prompt</title> |
| 11 |
<script src="../base.js"></script> |
| 12 |
<script> |
| 13 |
goog.require('goog.ui.Prompt'); |
| 14 |
</script> |
| 15 |
<link rel="stylesheet" href="css/demo.css"> |
| 16 |
<style> |
| 17 |
.modal-dialog-bg { |
| 18 |
position: absolute; |
| 19 |
top: 0px; |
| 20 |
left: 0px; |
| 21 |
background-color: #FFF; |
| 22 |
} |
| 23 |
|
| 24 |
.modal-dialog { |
| 25 |
position: absolute; |
| 26 |
top: 0px; |
| 27 |
left: 0px; |
| 28 |
width: 300px; |
| 29 |
background-color: #AAF; |
| 30 |
border: 2px solid #99c0ff; |
| 31 |
} |
| 32 |
|
| 33 |
.modal-dialog-title { |
| 34 |
position:relative; |
| 35 |
background: #C3D9FF; |
| 36 |
padding: 4px; |
| 37 |
font: bold 11px verdana; |
| 38 |
cursor: default; |
| 39 |
} |
| 40 |
|
| 41 |
.modal-dialog-content { |
| 42 |
background: #E8EEF7; |
| 43 |
padding: 12px 18px 12px 18px; font: normal 12px verdana; |
| 44 |
font: normal 12px verdana; |
| 45 |
} |
| 46 |
|
| 47 |
.modal-dialog-userInput { |
| 48 |
font: normal 12px verdana; |
| 49 |
width: 90%; |
| 50 |
} |
| 51 |
|
| 52 |
.modal-dialog-buttons { |
| 53 |
background: #E8EEF7; |
| 54 |
padding: 4px; |
| 55 |
font: normal 12px verdana; |
| 56 |
text-align: right; |
| 57 |
} |
| 58 |
|
| 59 |
.modal-dialog-buttons button { |
| 60 |
margin: 5px; |
| 61 |
} |
| 62 |
</style> |
| 63 |
</head> |
| 64 |
|
| 65 |
<body> |
| 66 |
<h1>goog.ui.Prompt</h1> |
| 67 |
|
| 68 |
<p>The default text is selected when the prompt displays</p> |
| 69 |
|
| 70 |
<p>You can use 'Enter' or 'Esc' to click 'Ok' or 'Cancel' respectively</p> |
| 71 |
|
| 72 |
<p> |
| 73 |
<a href="#" onclick="prompt.setDefaultValue('Pink');prompt.setVisible(true);"> |
| 74 |
Prompt |
| 75 |
</a> |
| 76 |
</p> |
| 77 |
<script> |
| 78 |
var promptHandler = function(response) { |
| 79 |
if (response == null) { |
| 80 |
alert('Afraid to answer?'); |
| 81 |
} else { |
| 82 |
alert('I like ' + response + ' too!'); |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
var prompt = new goog.ui.Prompt( |
| 87 |
'Information Required', |
| 88 |
'What is your favorite color?', |
| 89 |
promptHandler); |
| 90 |
</script> |
| 91 |
</body> |
| 92 |
</html> |