Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[e] (0) <noscript> example
git-svn-id: http://svn.whatwg.org/webapps@3793 340c8d12-0b0e-0410-8428-c7bf67bfef74
- Loading branch information
|
||
</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> |
|
||
</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> |