Intro to form elements

inputs

type example script
reading an input field from within a form


<form>
<input name="yep"><br>
<input type="button" value="go" onclick="alert(yep.value)">
</form>
reading an input field
unsuccessfully
from outside the form

<form> <input name="yep"></form>
<form> <input type="button" value="go" onclick="alert(yep.value)">
</form>
reading an input from
elsewhere in the document,
successfully

<form name="a"> <input name="yep"></form>
<form> <input type="button" value="go" onclick="alert(a.yep.value)">
</form>
using input values outside the document


<script>function f( ){ alert(document.b.y.value)}</script>
<form name="b">
<input name="y">
<input type="button" value="go" onclick="f()"></form>
listening to an input field


 <input name= "a"onkeyup="b.value=a.value">
        <input name="b">