Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[e] (0) <noscript> example
git-svn-id: http://svn.whatwg.org/webapps@3793 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 10, 2009
1 parent 754c281 commit 6a85245
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
32 changes: 32 additions & 0 deletions index
Expand Up @@ -12613,6 +12613,38 @@ not-slash = %x0000-002E / %x0030-10FFFF

</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>&lt;form action="calcSquare.php"&gt;
&lt;p&gt;
&lt;label for=x&gt;Number&lt;/label&gt;:
&lt;input id="x" name="x" type="number"&gt;
&lt;/p&gt;
&lt;script&gt;
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&gt;
&lt;noscript&gt;
&lt;input type=submit value="Calculate Square"&gt;
&lt;/noscript&gt;
&lt;/form&gt;</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>
Expand Down
32 changes: 32 additions & 0 deletions source
Expand Up @@ -13454,6 +13454,38 @@ not-slash = %x0000-002E / %x0030-10FFFF

</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>
Expand Down

0 comments on commit 6a85245

Please sign in to comment.