javascript中this的用法 感觉太灵活,不知道能有什么办法能准确识别this指向的是哪个对象? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 alert(this);function(){var me=this;alert(me);this.name=function(){alert(me)}} 我是个菜鸟,不是很懂楼上的代码的含义,bhtfg538 能否解释一下!谢谢! this 一般指的是当前的对象。也就是你当前所操作的对象,方法... 关键字this总是指向调用该方法的对象.可以用alert(this.tostring())或者alert(this.valueof())测试调用的对象的名字 <marquee direction="up" onmousemove="this.stop()" onmouseout="this.start()" scrollamount="1">淡淡的</marquee>这是一个滚动的文字 这里的this==当你用鼠标移动到(淡淡的)这个东东 var self = this;timer=windows.setInterval(self.drop.bind(self),50);和以下代码的this是同样的吗?timer=windows.setInterval(this.drop.bind(this),50); <input id="btn1" type="button" value="Button1" onclick="javascript:alert(this.id);" /> <script language="javascript" type="text/javascript"> function fun(){ this.open("*.aspx", "null", ""); } </script> <input id="btn2" type="button" value="Button2" onclick="javascript:fun();" /> 第一个this指的是按钮btn1对象 第二个this指的是窗体window对象 var self = this; timer=windows.setInterval(self.drop.bind(self),50); 和以下代码的this是同样的吗? timer=windows.setInterval(this.drop.bind(this),50); 小白求助一个问题,急求,谢谢 js关于带"#"参数的自身页面跳转问题 求高手 下拉选项如何传递元素? javascript动态生成输入框疑问 js中点击空白区域,隐藏含有iframe的层的问题,请大家支招 急 坐等答案! 关于jsp全局变量如何在做js方法参数 js表单提交如何兼容IE 在javascript怎样遍历dom树 asp.net的问题需要用JS来解决,所以就来这里啊,大家要帮忙哦~~~~~ vml中如何隐藏图形对象 希望好心的高手帮我这个动态增加文本框的问题
function()
{
var me=this;
alert(me);
this.name=function(){alert(me)}
}
可以用alert(this.tostring())或者alert(this.valueof())测试调用的对象的名字
这是一个滚动的文字 这里的this==当你用鼠标移动到(淡淡的)这个东东
timer=windows.setInterval(self.drop.bind(self),50);
和以下代码的this是同样的吗?
timer=windows.setInterval(this.drop.bind(this),50);
<script language="javascript" type="text/javascript">
function fun(){
this.open("*.aspx", "null", "");
}
</script>
<input id="btn2" type="button" value="Button2" onclick="javascript:fun();" /> 第一个this指的是按钮btn1对象
第二个this指的是窗体window对象
timer=windows.setInterval(self.drop.bind(self),50);
和以下代码的this是同样的吗?
timer=windows.setInterval(this.drop.bind(this),50);