HTML5——行走日记
效果展示:

代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<!--定义样式-->
<style>
* {
margin: ;
padding: ;
} li {
list-style: none;
} #div1, #div2 {
float: left;
width: 400px;
height: 400px;
border: 1px # solid;
margin: 10px;
position: relative;
overflow: hidden;
} #div2 ul {
position: absolute;
left: ;
width: 2000px;
} #div2 ul .box {
width: 400px;
height: 400px;
float: left;
overflow: hidden;
} #div2 #childUl {
width: 400px;
} #childUl li {
width: 400px;
border-bottom: 1px # dashed;
} #map {
width: %;
height: 380px;
}
</style>
<script src="scripts/move.js"></script>
<script src="http://api.map.baidu.com/api?v=1.3"></script>
<script> window.onload = function(){
var oDiv = document.getElementById('div1');
var aInput = oDiv.getElementsByTagName('input');
var oT = document.getElementById('t1'); var iNow = window.localStorage.getItem('num') || ; var oChildUl = document.getElementById('childUl');
var aChildLi = oChildUl.getElementsByTagName('li'); var oUl = document.getElementById('ul1');
var aBox = oUl.getElementsByClassName('box'); var aBox1_input = aBox[].getElementsByTagName('input');
var aBox1_div = aBox[].getElementsByTagName('div'); var oBox2_input = aBox[].getElementsByTagName('input')[];
var index = ;
//窗体加载时就展示数据
if( window.localStorage.getItem('num') ){ for(var i=;i<iNow;i++){
var oLi = document.createElement('li');
oLi.innerHTML = window.localStorage.getItem('title'+i);
oChildUl.appendChild( oLi ); } changeLi(); } aInput[].onclick = function(){ //保存本地 window.localStorage.setItem('title'+iNow,aInput[].value);
window.localStorage.setItem('ta'+iNow,oT.value); createLi(); iNow++; window.localStorage.setItem('num',iNow); }; aInput[].onclick = function(){ //提交后台
}; aInput[].onclick = function(){ //删除所有的数据
window.localStorage.clear();
}; aInput[].onclick = function(){ var This = this; navigator.geolocation.getCurrentPosition(function(position){ var y = position.coords.longitude;
var x = position.coords.latitude; if( This.checked ){
window.localStorage.setItem('y'+iNow,y);
window.localStorage.setItem('x'+iNow,x);
}
else{
window.localStorage.removeItem('y'+iNow);
window.localStorage.removeItem('x'+iNow);
} }); }; function createLi(){ var oLi = document.createElement('li');
oLi.innerHTML = window.localStorage.getItem('title'+iNow);
oChildUl.appendChild( oLi ); changeLi(); } function changeLi(){ for(var i=;i<aChildLi.length;i++){
aChildLi[i].index = i;
aChildLi[i].onclick = function(){ startMove(oUl,{left : -aBox[].offsetWidth }); aBox1_div[].innerHTML = window.localStorage.getItem('title'+this.index);
aBox1_div[].innerHTML = window.localStorage.getItem('ta'+this.index); if( window.localStorage.getItem('y'+this.index) ){
aBox1_input[].disabled = false; }
else{
aBox1_input[].disabled = true;
} index = this.index; };
} } aBox1_input[].onclick = function(){ startMove(oUl,{left : }); }; aBox1_input[].onclick = function(){ startMove(oUl,{left : -*aBox[].offsetWidth}); var map = new BMap.Map("map");
var y = window.localStorage.getItem('y'+index);
var x = window.localStorage.getItem('x'+index);
var title = window.localStorage.getItem('title'+index);
var text = window.localStorage.getItem('ta'+index);
var point = new BMap.Point(y, x);
map.centerAndZoom(point,);
map.enableScrollWheelZoom(); var marker1 = new BMap.Marker(point);
map.addOverlay(marker1); var opts = {
width : , // 信息窗口宽度
height: , // 信息窗口高度
title : title // 信息窗口标题
} var infoWindow = new BMap.InfoWindow(text, opts);
map.openInfoWindow(infoWindow,point); }; oBox2_input.onclick = function(){ startMove(oUl,{left : -aBox[].offsetWidth }); }; }; </script>
</head> <body>
<div id="div1">
标题:<input type="text" /><br />
内容:<textarea id="t1" style="height:300px; width:300px;"></textarea><br />
<input type="button" value="保存本地" />
<input type="button" value="同步服务器" />
<input type="button" value="删除所有数据" />
<input type="checkbox" />记录地图位置
</div>
<div id="div2">
<ul id="ul1">
<li class="box">
<ul id="childUl"></ul>
</li>
<li class="box">
<input type="button" value="后退" />
<input style="float:right" type="button" value="前进" />
<div></div>
<div></div>
</li>
<li class="box">
<input type="button" value="后退" />
<div id="map"></div>
</li>
</ul>
</div>
</body>
</html>
move.js文件下载:http://pan.baidu.com/s/1nvs3uGh
HTML5——行走日记的更多相关文章
- 微信小程序开发日记——高仿知乎日报(上)
本人对知乎日报是情有独钟,看我的博客和github就知道了,写了几个不同技术类型的知乎日报APP 要做微信小程序首先要对html,css,js有一定的基础,还有对微信小程序的API也要非常熟悉 我将该 ...
- HTML5笔记1——HTML5的发展史及标签的改变
记得第一次接触HTML5还是在<联信永益>实习那会儿(2011),当时一个项目技术选型的时候面临两种选择,分别是Silverlight和HTML5,那是用的最新的IE浏览器版本还是IE9, ...
- 08. Web大前端时代之:HTML5+CSS3入门系列 ~ QQ空间时间轴
Web大前端时代之:HTML5+CSS3入门系列:http://www.cnblogs.com/dunitian/p/5121725.html 大前端系列,主要就是使用CSS3.0来实现,注释我已经打 ...
- 精选9个值得学习的 HTML5 效果【附源码】
这里精选了一组很酷的 HTML5 效果.HTML5 是现 Web 开发领域的热点, 拥有很多让人期待已久的新特性,特别是在移动端,Web 开发人员可以借助 HTML5 强大功能轻松制作各种交互性强.效 ...
- 让你心动的 HTML5 & CSS3 效果【附源码下载】
这里集合的这组 HTML5 & CSS3 效果,有的是网站开发中常用的.实用的功能,有的是先进的 Web 技术的应用演示.不管哪一种,这些案例中的技术都值得我们去探究和学习. 超炫的 HTML ...
- 结合 CSS3 & Canvas 模拟人行走的效果
HTML5 和 CSS3 技术给 Web 带来了新的利器,点燃了 Web 开发人员的激情.所谓只有想不到,没有做不到,的确如此.下面给大家分享一个结合 CSS3 & Canvas 模拟人行走的 ...
- HTML5 Geolocation 构建基于地理位置的 Web 应用
HTML5 中的新功能 HTML5 是最新一代的 HTML 规范,是 W3C 与 WHATWG 合作的结果,目前仍外于开发中.自从上一代 HTML4,Web 世界已经发生了巨大的变化,HTML5 的到 ...
- html5游戏引擎phaser官方示例学习
首发:个人博客,更新&纠错&回复 phaser官方示例学习进行中,把官方示例调整为简明的目录结构,学习过程中加了点中文注释,代码在这里. 目前把官方的完整游戏示例看了一大半, brea ...
- 8款超酷的HTML5 3D图片动画源码
1.HTML5移动端图片左右切换动画 今天要给大家分享一款很不错的图片左右切换焦点图动画,并且支持移动端触摸滑动.功能上,这款HTML5图片播放器支持鼠标滑动.手机端触摸滑动以及自动播放.外观上,这款 ...
随机推荐
- C++ new(3)
转载自:http://www.builder.com.cn/2008/0104/696370.shtml “new”是C++的一个关键字,同时也是操作符.关于new的话题非常多,因为它确实比较复杂,也 ...
- CORDIC原理与FPGA实现(2)
CORDIC算法实现极坐标(polar)到直角坐标系(Cartesian)的变换. 1: function [horizonal,vertical]=polar2car(mag, pha); 2: x ...
- TestNG之参数化
TestNG提供了两种参数化的方式,一种是通过XML,一种是通过代码实现,下面对这两种方式做介绍. 一.通过xml /** * <suite name="Suite" par ...
- 渐进记号 Asymptotic Notations-------geeksforgeeks 翻译
我们已经简单的讨论了下渐进分析以及最坏,平均和最佳情况的分析.渐进分析的主要思想是分析算法的效率,不用依靠计算机的具体快慢,不需要实现这个算法,也不需要真正去计算时间.渐进记号是一种数学的工具来表示渐 ...
- hdu-5895 Mathematician QSC(数学)
题目链接: Mathematician QSC Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Jav ...
- Win8/8.1 .NET3.5安装失败
.NetFramework 作为开发人员,很多情况都需要.NetFramework,在Win7及之前的系统上直接双击 .NetFramework的安装包就可安装了. Win8/8.1无法安装.Net3 ...
- css3高级运动keyframes
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- mysql完整备份时过滤掉某些库
mysql进行完整备份时使用--all-database参数比如:#mysqldump -u root -h localhost -p --all-database > /root/all.sq ...
- Windows下安装Redmine
参考链接:http://www.cnblogs.com/afarmer/archive/2011/08/06/2129126.html 最新教程:http://www.myexception.cn/w ...
- 给vps设置ssh供爬墙使用
在服务器上建一个 username : 添加用户:useradd -s /bin/false username,将用户的shell设置成/bin/false.这样用户就无法与系统进行交互. 设置密码: ...