zoukankan      html  css  js  c++  java
  • 潭州课堂25班:Ph201805201 周五 (课堂笔记)

    小三角:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            div{
                border-top:  30px solid transparent;            /**透明色*/
                border-right: 30px solid gray;
                border-bottom: 30px solid transparent ;         /**透明色*/
                border-left: 30px solid transparent;
                display: inline-block;                          /*块级拥有行类特性*/
            }
            div:hover{
                border: 30px solid transparent;
                border-left: 30px solid navy;
            }
        </style>
    </head>
    <body>
        <div></div>
    </body>
    </html>
    

      

      

    控制背景图移动

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            div{
                height: 350px;
                 350px;
                background: url("21.jpg") no-repeat;        /* no-repeat 不平铺*/
            }
        </style>
    </head>
    <body>
        <div></div>
        <p>
            <input type="button" value="上">
            <input type="button" value="下">
            <input type="button" value="左">
            <input type="button" value="右">
        </p>
    
        <script>
            var btn = document.getElementsByTagName('input');
            var box = document.getElementsByTagName('div')[0];
            btn[0].onclick = function () {
                // console.log('1')
                box.style.backgroundPositionX = '0px';                      // 背景图 X
                box.style.backgroundPositionY = '0px';                   // 背景图 Y
            };
            btn[1].onclick = function () {
                // console.log('2')
                box.style.backgroundPositionX = '0px';                      // 背景图 X
                box.style.backgroundPositionY = '-350px';                   // 背景图 Y
            };
            btn[2].onclick = function () {
                // console.log('3')
                box.style.backgroundPositionX = '-350px';                      // 背景图 X
                box.style.backgroundPositionY = '0px';                   // 背景图 Y
            };
            btn[3].onclick = function () {
                // console.log('4')
                box.style.backgroundPositionX = '-350px';                      // 背景图 X
                box.style.backgroundPositionY = '-350px';                   // 背景图 Y
            }
        </script>
    </body>
    </html>
    

      以这整张为背景,在 div 开4分之1 图大小窗口,控制背景图的 X/Y 的移动,

    在输入框中的数据 + 1

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <input type="button" value="-">
        <input type="text" name="num">
        <input type="button" value="+">
    
        <script>
            var obj = document.getElementsByTagName('input')
            obj[0].onclick = function () {
                obj[1].value -= 1
            }
             obj[2].onclick = function () {                 // 在 js 中 + 号表示字符串合并,这里 obj[1].value 是 str  
               obj[1].value =  Number(obj[1].value) +1
            }
        </script>
    </body>
    </html>
    

      

    局部刷新 

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            .test1{
                height: 200px;
                 200px;
                background: skyblue;
            }
            .test{
                 100%;
                height: 8000px;
            }
        </style>
    </head>
    <body>
        <div class="test1">参照</div>
        <input type="button" value="登录">
        <div class="test">
            <!--<iframe src="http://www.taobao.com"></iframe>-->
        </div>
    
        <script>
            var btn = document.getElementsByTagName('input')[0];
            btn.onclick = function (){
                var box = document.getElementsByClassName('test')[0];
                box.innerHTML = "<iframe style='' src="http://www.taobao.com/"></iframe>"
            }
        </script>
    </body>
    </html>
    

      

  • 相关阅读:
    LeetCode 81 Search in Rotated Sorted Array II(循环有序数组中的查找问题)
    LeetCode 80 Remove Duplicates from Sorted Array II(移除数组中出现两次以上的元素)
    LeetCode 79 Word Search(单词查找)
    LeetCode 78 Subsets (所有子集)
    LeetCode 77 Combinations(排列组合)
    LeetCode 50 Pow(x, n) (实现幂运算)
    LeetCode 49 Group Anagrams(字符串分组)
    LeetCode 48 Rotate Image(2D图像旋转问题)
    LeetCode 47 Permutations II(全排列)
    LeetCode 46 Permutations(全排列问题)
  • 原文地址:https://www.cnblogs.com/gdwz922/p/9417213.html
Copyright © 2011-2022 走看看