zoukankan      html  css  js  c++  java
  • 自学项目所得

    回车事件后提交表单:

    <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'" />
  • 相关阅读:
    (九)MySQL用户和权限管理
    activemq修改admin密码
    zookeeper与activemq整合
    (十一)数组array
    (十)while和until循环
    (八)MySQL索引操作
    查看MySQL是否在运行
    MySQL的启动和关闭
    常用的Web服务器软件整理
    [CodeForce 801A] Vicious Keyboard
  • 原文地址:https://www.cnblogs.com/wanjn/p/7989368.html
Copyright © 2011-2022 走看看