An expression references a member of a class-based object, but the object does not have a member with that name.
If the code is contained in an ASP.NET page, the code might define a constructor function within a <script runat="server"> block that uses the this statement. The expando modifier should be applied to every constructor function definition in a <script runat="server"> block.
For example, the following code for an ASP.NET page uses a constructor function marked with the expando modifier.
В | ![]() |
---|---|
<script runat="server"> expando function Person(name) { // If the expando modifier was not applied to the definition of Person, // the this statment in the following line of code would generate error // JS1151 this.name = name; } </script> <% var fred = new Person("Fred"); Response.Write(fred.name); %> |
To correct this error
-
Make sure that the expression references an existing member of the class-based object and that the member name is correctly spelled.
-
Make sure to apply the expando modifier to each constructor function declaration in a <script runat="server"> block.
See Also
Reference
this Statementexpando Modifier
Concepts
Other Resources
JScript ReferenceClass-based Objects