faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

30 of 47 people (64%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

JavaScript: Object: Current: Parameter: How to pass current object as parameter to function? [this]

Feb 22nd, 2005 23:54
jsWalter, Joe Bloggs, Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 25 November 2020 - 05:36 pm -------------------
JavaScript: Object: Current: Parameter: How to pass current object as 
parameter to function? [this]
---
Use e.g. the 'this' command.
---
---
e.g.
--- cut here: begin --------------------------------------------------
<!-------------------------------------------------------------------->
<HTML>
<!-------------------------------------------------------------------->
<HEAD>
<!-------------------------------------------------------------------->
<SCRIPT>
<!-------------------------------------------------------------------->
function PROCTest( object ) {
 alert( object.name );
}
<!-------------------------------------------------------------------->
</SCRIPT>
<!-------------------------------------------------------------------->
</HEAD>
<!-------------------------------------------------------------------->
<BUTTON
  NAME="mybuttonname1"
  ONCLICK='
   PROCTest( this );
  '
>
<!-------------------------------------------------------------------->
SHOW NAME OF CURRENT OBJECT
<!-------------------------------------------------------------------->
</BUTTON>
<!-------------------------------------------------------------------->
</HTML>
<!-------------------------------------------------------------------->
--- cut here: end ----------------------------------------------------
---
---
Book: see also:
---
[book: Goodman, Danny - JavaScript bible]
---
---
Internet: see also:
---
JavaScript: Form: Current: Parameter: How to pass current form as 
parameter to function? [this.form]
http://www.faqts.com/knowledge_base/view.phtml/aid/32367/fid/129
----------------------------------------------------------------------