回车事件后提交表单:

<input type="password" value="" name="password" id="password" onKeyDown="javascript:if(event.keyCode==13){doSubmit(); }" title="请您输入密码"/>

 页面加载完毕后,光标聚焦到某个文本框,在页面下面的添加类似如下代码:

<script type="text/JavaScript">
    document.getElementById('login_main').userName.focus();
</script>

其中,login_main是表单id,userName是文本框的id

jquery 方法:

$(selector).html():得到选择器匹配的元素内容
$(selector).html(content):设置选择器匹配的元素内容

 js方法:

鼠标移动过获得焦点,获得焦点的同时选中文本框中填入的所有内容,主要是focus()方法和select()方法的使用

<input type="password" value="" name="password" id="password"  onMouseOver="this.focus();" onFocus="this.select();" title="请您输入密码"/>

 鼠标移入移出改变背景图片

<input class="reset_img" value="清空" type="reset"  onmouseover="this.style.background='url(a.png) no-repeat'" onmouseout= "this.style.background='url(b.png) no-repeat'" />

 

 posted on 2017-12-05 21:02  改变一下  阅读(105)  评论(0)    收藏  举报