Index: chrome/common/extensions/docs/extensions/options.html |
diff --git a/chrome/common/extensions/docs/extensions/options.html b/chrome/common/extensions/docs/extensions/options.html |
index fad14202b636b0a86353006a055a32a7444cbf16..71680e4d9e470a394e801a23feb80a851a13ed4d 100644 |
--- a/chrome/common/extensions/docs/extensions/options.html |
+++ b/chrome/common/extensions/docs/extensions/options.html |
@@ -222,9 +222,7 @@ |
}</pre> |
<a name="H2-1"></a><h2>Step 2: Write your options page</h2> |
Here is an example options page: |
-<pre><html> |
-<head><title>My Test Extension Options</title></head> |
-<script type="text/javascript"> |
+<pre>// Save this script as `options.js` |
// Saves options to localStorage. |
function save_options() { |
var select = document.getElementById("color"); |
@@ -252,8 +250,13 @@ function restore_options() { |
} |
} |
} |
-</script> |
-<body onload="restore_options()"> |
+document.addEventListener('DOMContentReady', restore_options); |
+document.querySelector('#save').addEventListener('click', save_options); |
+</pre> |
+<pre><html> |
+<head><title>My Test Extension Options</title></head> |
+<script src="options.js"> |
+<body> |
Favorite Color: |
<select id="color"> |
<option value="red">red</option> |
@@ -262,7 +265,8 @@ Favorite Color: |
<option value="yellow">yellow</option> |
</select> |
<br> |
-<button onclick="save_options()">Save</button> |
+<div id="status"></div> |
+<button id="save">Save</button> |
</body> |
</html> |
</pre> |