this用在指定DOM对象上,例如<a href="javascript:onclick(this)">This测试</a>,这里的this实际上就是"This测试"这个超链接。
关于作用于问题,自然是在对象内部了。还有一种类似类的用法,function Person(name, age)
{
this.Name = name;
this.Age = age;
}var p = new Person("Mike", 30);alert("I am " + p.Name + ", and " + p.Age + " years old!");
关于作用于问题,自然是在对象内部了。还有一种类似类的用法,function Person(name, age)
{
this.Name = name;
this.Age = age;
}var p = new Person("Mike", 30);alert("I am " + p.Name + ", and " + p.Age + " years old!");
this表示触发的对象.
当前的this就是<A>了.
比如:<input type="text" onclick="hehe(this.value)" />
this也可以代表自己
function hehe(id,name)
{
this.id=id;
this.name=name
}
<head>
<table class="grid" id="employee">
<caption>Employees List</caption>
<thead>
<tr>
<th colspan="2" class="buttons"><a class="new" href="#" onclick="newRecord(this);" title="Add a record"><span>New</span></a></th>
<th id="id">ID</th>
<th id="name">Name</th>
<th id="email">email</th>
<th id="salary">Salary</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</BODY>
</HTML>请问上面的 "this" 是指谁的对象?再次感谢!
以上的