jQuery中event.target和this的区别?
this和event.target的区别:
1.js中事件是会冒泡的,所以this是可以变化的,但event.target不会变化,它永远指向触发事件的DOM元素本身;
2.this和event.target都是dom对象,使用jQuey中的方法可以将他们转换为jquery对象:$(this)和$(event.target).假设htm是<div><span></span></div>点击span的时候改变span的颜色,使用this的话点击span因为事件冒泡机制,div也会改变颜色,但是使用event.target不会。
jqueryjs当文本框获得焦点时,如何自动选中里面的文字?
$(function(){$(":text").focus(function(){this.select();});});JQuery文本框获得焦点背景颜色改变:
1.先使用jQuery选择器找到所有的文本框。
2.为文本框注册获得焦点事件,即focus事件。
3.在焦点事件的事件处理函数中对当前得到焦点的文本框设置背景色。
4.注册失去焦点事件,即blur事件。
5.在失去焦点的事件处理函数中对当前触发事件的文本框改变背景颜色。
there was和there were怎么区分?
区分就是根椐紧跟其后的名词单复数形式决定,中文意思是某地有某物或某人,具体的不同如下
there was的例句
Sometimes a mist seemed to be falling, and sometimes there was a sudden downpour of heavy, slanting rain.一忽儿像是下大雾,突然间又下起倾盆大雨。
there were的例句
Before jQuery 1.3, there were three ways to get around this problem, none of them elegant (for those of you who continue to use jQuery 1.2.x, these are still valid).
中关于用createElement()和appendChild()创建select的方法?
jQuery.fn.addOption = function(text,value)<br>
{<br>
jQuery(this).get(0).options.add(new Option(text,value));<br>
}<br>这是个脚本,为指定select追加option<br>function openendtime(){<br>
//var beginvalue= $(timeBegin).val();<br>
$(timeEnd).empty();//添加前清空select选项<br>
//alert(beginvalue);<br>
for(i=0;i<这里是mysql返回的数据集长度;i++){<br>
$(timeEnd).addOption(显示值,option的value值);//调用<br>
}<br><br>
}<br><br>修改下你应该就可以用!!!
还没有评论,来说两句吧...