- From: poot <cvsmail@w3.org>
- Date: Thu, 10 Sep 2009 20:13:38 +0900 (JST)
- To: public-html-diffs@w3.org
hixie: <noscript> example (whatwg r3793) http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2962&r2=1.2963&f=h http://html5.org/tools/web-apps-tracker?from=3792&to=3793 =================================================================== 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:14:19 UTC