由于每个的内容都不是很多, 就写在一个页面里了
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <script src="http://cdn.bootCSS.com/jquery/2.1.4/jquery.min.js"></script> http://cdn.bootcss.com/jquery/2.1.4/jquery.min.js%22%3E%3C/script%3E ;
- <title>Title</title>
- <style>
- .wrap{width:100%;height:700px;}
- .d1{width:300px;height:400px;overflow: auto;border:1px solid red;}
- .ui_button{border-radius:5px;color:#ffffff;background-color:#ffa430;font-size:13px;padding:5px 10px;}
- </style>
- </head>
- <body>
- <div class="wrap">
- <div class="d1">
- <p style="height:60px"></p>
- </div>
- <p> 使用 label 元素与 file 控件关联, input file 类型控件有一个属性, 名为 accept.
可以用来指定浏览器接受的文件类型, 也就是的那个我们打开系统的选择文件弹框的时候, 默认界面中呈现的文件类型.</p>
- <label class="ui_button ui_button_primary" for="xFile"> 上传文件 </label>
- <form><input type="file" id="xFile" style="position:absolute;clip:rect(0 0 0 0);" accept="image/"></form>
- <!-- 虽然使用 accept="image/" 很方便, 但是在 Chrome 浏览器下, 可能会有文件选择窗口打开非常慢点问题, 因此, 如果仅仅是上传图片, 建议使用:
- accept="image/png, image/jpeg, image/gif, image/jpg" -->
- </div>
- </body>
- <script>
- // 方法一: 使用正则表达式
- console.log(String(123067).replace(/(\d)(?=(\d{3})+$)/g, "$1,"));
- // 方法二: 使用 toLocaleString() 方法
- console.log((2134506145).toLocaleString('en-US'));
- </script>
来源: http://www.qdfuns.com/article/47381/261c629a73bfef77dc43b1e5b80e4f02.html