- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 10 Sep 2009 11:13:10 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec In directory hutz:/tmp/cvs-serv14482 Modified Files: Overview.html Log Message: <noscript> example (whatwg r3793) Index: Overview.html =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.2962 retrieving revision 1.2963 diff -u -d -r1.2962 -r1.2963 --- Overview.html 10 Sep 2009 09:54:56 -0000 1.2962 +++ Overview.html 10 Sep 2009 11:13:07 -0000 1.2963 @@ -11172,6 +11172,36 @@ even when <a href="#concept-n-script" title="concept-n-script">scripting is enabled</a> for the element.</p> + </div><div class="example"> + + <p>In the following example, a <code><a href="#the-noscript-element">noscript</a></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 id="sections"><span class="secno">4.4 </span>Sections</h3><h4 id="the-body-element-0"><span class="secno">4.4.1 </span>The <dfn><code>body</code></dfn> element</h4><dl class="element"><dt>Categories</dt> <dd><a href="#sectioning-root">Sectioning root</a>.</dd> <dt>Contexts in which this element may be used:</dt>
Received on Thursday, 10 September 2009 11:13:23 UTC