[Javascript] Object References
Flavio Gomes
flavio at economisa.com.br
Fri Jun 4 15:41:12 CDT 2004
Yes, there's a with statement:
<form name=myForm>
First Name:<br><input name=firstname size=30><br>
Surname:<br><input name=surname size=30>
</form:
with(document.myForm)
{
alert(firstname);
alert(surname);
}
---
Flavio Gomes
flavio at economisa.com.br
Mike Dougherty wrote:
> Given this:
>
> var loTP = (some object)
> for (itm in loTP.Area0112) {
> loTP.Area0112[itm].prop0 = (something)
> loTP.Area0112[itm].prop1 = (something else)
> loTP.Area0112[itm].prop2 = (something else)
> }
>
> Would it be "better" to reduce the object references to this:
>
> var loTP = (some object)
> for (itm in loTP.Area0112) {
> var loCurObj = loTP.Area0112[itm]
>
> loCurObj.prop0 = (something)
> loCurObj.prop1 = (something else)
> loCurObj.prop2 = (something else)
> }
>
> Is there a "With" construct? what is the syntax/usage? (does it
> matter?)
> (My question is whether or not there is a reason to reduce the length
> of the reference, not to ask about syntax I probably could look up)
>
More information about the Javascript
mailing list