[thelist] Javascript "this" Question
Mark Howells
mark at mountain.ch
Thu Dec 27 11:00:42 CST 2001
> josh (evolt at efeingold.com) wrote:
> <script language=JavaScript>
> function hidden() {
> values = this.value
> }
> </script>
One of the more common ways of using 'this' is as follows.
<script language="javascript" type="text/javascript">
<!--
function checkMe(){
if(this.value!=""&&confirm("Clear field?")){
this.value=""}
}
//-->
</script>
<form name="login">
<input type="text" name="username" onclick="checkMe()">
</form>
'this' relates to the element which currently has focus; in the example, the
form field 'username'.
Regards
Mark Howells
Working in a Winter Wonderland
http://www.mark.ac
More information about the thelist
mailing list