zoukankan      html  css  js  c++  java
  • js


    希望把某个元素移除你的视线
    1.display :none ;显示为无
    2.visibility :hidden;隐藏
    3.widthheight
    4.透明度
    5.left op
    6.拿一个白色DIV盖住它
    7.margin负值

    写一个JS效果的步骤
    1.先实现布局
    2.实现原理
    3.了解Js语法

    Js中如何获取元素:
    1.通过ID名称来获取元素
    document get element by id 'link'
    document.getElementById(link)
    2.

    事件:
    鼠标事件 ,键盘事件,系统事件,表单事件,自定义事件

    onclick
    onmouseover鼠标移入
    onmouseout 鼠标移开
    onmouse 抚摸事件(就像是鼠标抚摸一样的事件)
    onmousedown 鼠标向上事件
    onmouseup 鼠标向下事件

    如何添加事件:
    元素.onmoerover
    函数:可以理解为-命令,做一些事
    function abc(){肯定不会主动执行的
    .....
    }
    1 直接调用:abc();
    2 事件调用:元素.事件=函数名 oDiv.onclick=abc;
    3 function(){      //匿名函数

    }

    测试:
    alert(1);带一个确定按钮的警告框
    alert('ok');'ok'字符串
    alert("ok");

    代码如下:

    <script>
    // alert(1);常见错误
    document.getElementById('link').onmouseover=show;
    document.getElementById('link').onmouseout=hide;
    function show(){
    document.getElementById('ul1').style.display='block';
    document.getElementById('link').style.background='yellow';

    }
    function hide(){
    document.getElementById('ul1').style.display='none';
    document.getElementById('link').style.background='#F1F1F1';

    }
    abc();

    </script>

  • 相关阅读:
    c# IOSerialize 验证码、图片缩放
    SqlServer 分库分表
    权限系统数据库设计
    SqlServer 读写分离
    树转二叉树
    数据结构:图的存储结构之邻接矩阵、邻接表
    【数据结构】数据结构-图的基本概念
    哈夫曼树
    二叉树遍历方法
    Oracle 检查约束check
  • 原文地址:https://www.cnblogs.com/xuling123/p/6847560.html
Copyright © 2011-2022 走看看