[Javascript] Getting their values
Peter Brunone
peter at brunone.com
Mon Nov 5 12:54:21 CST 2001
| 1. How to know which element called the function (without arguments in a
| function e.g. do_it(test))?
What's wrong with a function parameter? doIt(this) will send a
reference to object itself as the parameter, e.g. if a select box calls
doIt(this) then function doIt(param) can display param.selectedIndex, which
will be the selectedIndex value of the calling object.
| 2. I've saved an objects name into another variable (var something =
| Practice; I have a <div> element with an id called Practice). But how can
I
| now reference to this object thru variable called something?
I believe you want the eval function, which turns a string into a
variable name. For example,
var myForm = eval("document.formName");
will set the myForm variable equal to the form.
Cheers,
Peter
----- Original Message -----
From: "Iztok Polanic" <iztokp at amis.net>
To: <javascript at LaTech.edu>
Sent: Monday, November 05, 2001 12:27 PM
Subject: [Javascript] Getting their values
| Hi!
|
| I've looked thru some books but I can't find this so please help me.
|
| 1. How to know which element called the function (without arguments in a
| function e.g. do_it(test))?
| 2. I've saved an objects name into another variable (var something =
| Practice; I have a <div> element with an id called Practice). But how can
I
| now reference to this object thru variable called something?
|
| document.all.something.innerHTML = ????
|
|
| Bye,
|
| Iztok
|
| _______________________________________________
| Javascript mailing list
| Javascript at LaTech.edu
| http://www.LaTech.edu/mailman/listinfo/javascript
|
More information about the Javascript
mailing list