Short URL: http://html5.org/r/3793
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 3793 | <noscript> example | 2009-09-10 11:17 |
Index: source
===================================================================
--- source (revision 3792)
+++ source (revision 3793)
@@ -13454,8 +13454,40 @@
</div>
+ <div class="example">
+ <p>In the following example, a <code>noscript</code> element is
+ used to provide fallback for a script.</p>
+ <pre><form action="calcSquare.php">
+ <p>
+ <label for=x>Number</label>:
+ <input id="x" name="x" type="number">
+ </p>
+ <script>
+ var x = document.getElementById('x');
+ var output = document.createElement('p');
+ output.textContent = 'Type a number; it will be squared right then!';
+ x.form.appendChild(output);
+ x.form.onsubmit = function () { return false; }
+ x.oninput = function () {
+ var v = x.valueAsNumber;
+ output.textContent = v + ' squared is ' + v * v;
+ };
+ </script>
+ <noscript>
+ <input type=submit value="Calculate Square">
+ </noscript>
+</form></pre>
+
+ <p>When script is enabled, a button appears to do the calculation
+ on the server side. When script is enabled, the value is computed
+ on-the-fly instead.</p>
+
+ </div>
+
+
+
<h3>Sections</h3>
<h4>The <dfn><code>body</code></dfn> element</h4>