zoukankan      html  css  js  c++  java
  • html5之range

    第一次以这种方式做笔记,希望可以加强自己对新知识的理解,更希望能得到更多朋友的指正.

    言归正传:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html class="no-js">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <style type="text/css">
    .no-js selector{style properties}
    </style>
    <body>
    <p>新的控件类型</p>
    生成滑动条:<input type="button" value="+" id="add" onclick="changeRange(this,'rg')"/>
    <input type="range" id="rg" min="10" max="100" step="10" onchange="change(this)"/>
    <input type="button" value="-" id="sub" onclick="changeRange(this,'rg')"/>
    <br/>
    <input type="text" id="show"/>
    <script type="text/javascript">
    function change(elem){ 
    var location=document.getElementById("show"); 
    location.value=elem.value; 
    } 
    function changeRange(elem,rgp){
    var targetId=elem.getAttribute("id");
    var rg=document.getElementById(rgp);
    var show=document.getElementById("show");
    if(targetId=='add'){
    var num=~~(rg.value);
    rg.value=num+10;
    }else if(~~(rg.value)>10){
    rg.value=~~(rg.value)-10;
    }
    show.value=rg.value;
    }
    </script>
    </body>
    </html>
    if you want to go fast,go alone,if you want to go far,go together
  • 相关阅读:
    git初学【常用命令、上传项目到码云或从码云拉取、克隆项目】
    dedecms自学
    sublime3使用笔记
    路由功能
    bootstrap模态框篇【遇到的问题】
    justgage.js的使用
    fullpage.js使用方法
    js&jq遇到的问题(不断更新中)
    图灵完备——停机问题
    中断
  • 原文地址:https://www.cnblogs.com/yinyl/p/5740488.html
Copyright © 2011-2022 走看看