HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
3793<noscript> example2009-09-10 11:17
@@ -13447,20 +13447,52 @@ not-slash     = %x0000-002E / %x0030-10FFFF
   <div class="impl">
 
   <p>The <code>noscript</code> element has no other requirements. In
   particular, children of the <code>noscript</code> element are not
   exempt from <span>form submission</span>, scripting, and so forth,
   even when <span title="concept-n-script">scripting is enabled</span>
   for the element.</p>
 
   </div>
 
+  <div class="example">
+
+   <p>In the following example, a <code>noscript</code> element is
+   used to provide fallback for a script.</p>
+
+   <pre>&lt;form action="calcSquare.php">
+ &lt;p>
+  &lt;label for=x>Number&lt;/label>:
+  &lt;input id="x" name="x" type="number">
+ &lt;/p>
+ &lt;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;
+  };
+ &lt;/script>
+ &lt;noscript>
+  &lt;input type=submit value="Calculate Square">
+ &lt;/noscript>
+&lt;/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>
 
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Sectioning root</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>

|