<html5+css3+js>一个audio note界面
2015-12-10 14:54
746 查看
(《javascript&jquery交互式web前端开发》学习记录)
![](https://img-blog.csdn.net/20151210145443381?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
HTML5:
CSS3:
代码下载:http://download.csdn.net/detail/qq_17615475/9351241
HTML5:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Audio Note</title> <link rel="stylesheet" href="audio-note.css" /> </head> <body> <div id="page"> <h1>ListKing</h1> <h2 id="noteName">Audio Note</h2> <form action=""> <label for="noteInput">Add the note title: </label> <input type="text" id="noteInput"/> <div id="buttons"><a data-state="record" href="">record</a> </div> </form> </div> <script src="audio-note.js"></script> </body> </html>
CSS3:
@charset "UTF-8"; /* CSS Document */ body{ background:#000000; font:"Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif; color:#FFFFFF; } #page{ background:#606060; max-width:480px; margin:0 auto; padding:0; } h1{ background:url(kinglogo.png) no-repeat center; text-indent:-1000%; overflow:hidden; height:75px; width:117px; line-height:75px; margin:0 auto; padding:30px 10px 20px; } h2{ text-align:center; font-size:200%; } form{ padding:0px 60px 65px; } label{ display:block; margin:10px auto; font-size:150%; } input{ display:block; background-color:#C6C6C6; border:1px solid #C6C6C6; border-radius:8px; width:100%; font-size:200%; margin:10px auto; } input:focus{ background-color:#FFFFFF; border:1px solid #FFFFFF; } #buttons{ width:100px; height:100px; margin:0 auto; } #buttons a{ width:100px; height:100px; text-indent:100%; margin-top:20px; display:inline-block; white-space:nowrap; /*不换行*/ overflow:hidden; } a[data-state='stop']{ background-image:url('pause.png'); } a[data-state='record']{ background-image:url('record.png'); }JS:
// JavaScript Document var noteInput,noteName,textEntered,target; noteName=document.getElementById('noteName'); noteInput=document.getElementById('noteInput'); function writeLabel(e){ if(!e){ //8-11行,兼容IE5-IE8 e=window.event; } target=e.target||e.srcElement; textEntered=target.value; noteName.textContent=textEntered; } function recorderControls(e){ if(!e){ e=window.event; } target=e.target||e.srcElement; if(e.preventDefault){ //取消事件的默认动作,这里为点击不 打开某个链接 e.preventDefault(); }else{ //兼容IE5-IE8 e.returnValue=false; } switch(target.getAttribute('data-state')){ case 'record': record(target); break; case 'stop': stop(target); break; } } function record(target){ target.setAttribute('data-state','stop'); target.textContent='stop'; } function stop(target){ target.setAttribute('data-state','record'); target.textContent='record'; } if(document.addEventListener){ document.addEventListener('click',function(e){ recorderControls(e); },false); noteInput.addEventListener('input',writeLabel,false); }else{ //兼容IE5-IE8 document.attachEvent('onclick',function(e){ recorderControls(e); }); noteInput.attachEvent('onkeyup',writeLabel); }
代码下载:http://download.csdn.net/detail/qq_17615475/9351241
相关文章推荐
- 初识backbone.js(1)
- Javascript常见操作
- JSON 中的毫秒时间( LONG) ,转换成年月日
- JavaScript 闭包
- js--在页面元素上(移动到或获取焦点)、鼠标离开(或失去焦点)
- gulpfile.js 中的坑--注入篇(gulp-inject,gulp-wiredep)
- js取json数据笔记
- 解决方案:Jboss修改jsp需要重启才生效
- JSON序列化与反序列化DataSet
- 【JavaScript 从零开始】 语言核心部分----可选的分号
- js unicode编码与解码
- js操作数组函数实例小结
- window.localtion.href深入理解
- JS获得URL参数
- JS模态窗口返回值兼容问题解决方案
- sso跨域写cookie的一段js脚本
- 对 Sea.js 进行配置 seajs.config
- ElasticSearch.js
- JS脚本动态给元素/控件添加事件
- html特殊字符的html,js,css写法汇总