首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • 关于一个简易web地图的实现请各位高手帮忙 [已结贴,结贴人:sunxiaofeng520]
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-06-11 11:05:40 楼主
    功能需求是这样的:
    有一个地图图片  在一个矩形框中显示  局部显示某个部分 可以缩小 和 放大 可拖拽 平移 就想google 和 百度地图一样
    只是没有动态数据而已 是个静态地图 大概是这样的 希望各位大虾 高手们 帮帮我吧!!!
    100  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-06-11 11:47:411楼 得分:0
    只是图片? 实现图片操作就行了
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-06-11 11:55:202楼 得分:0
    对 只是 图片 但就是不知道 怎么着手 做
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • showbo
    • 等级:
    发表于:2008-06-11 12:00:103楼 得分:100
    以前收藏的一个,你看看合适不合适


    HTML code
    <html> <head><title> </title> <script type="text/javascript" src="function.js"></script> <script type="text/javascript" src="PicView.js"></script> <script type="text/javascript"> var Pic; window.onload = function(){ Pic = new PicView("idShowpic", 700, 500); Pic.Load("http://b2b.lvyou168.cn/companys/images/Pwri806396.jpg"); } </script> </head> <body> <table align="center" style="border: solid 1px #C0C0C0;"> <tr> <td align="center"> <input name="" type="button" onclick="Pic.ZoomIn()" value="放大" /> <input name="" type="button" onclick="Pic.Reset()" value="实际大小" /> <input name="" type="button" onclick="Pic.Default()" value="最适合" /> <input name="" type="button" onclick="Pic.ZoomOut()" value="缩小" /> </td> </tr> <tr height="470"> <td align="center"> <div id="idShowpic"> </div> </td> </tr> </table> </body> </html>


    function.js
    JScript code
    // JavaScript Document var isIE = (document.all) ? true : false; var isIE6 = isIE && (navigator.userAgent.indexOf('MSIE 6.0') != -1); var $ = function (id) { return "string" == typeof id ? document.getElementById(id) : id; }; var $C = function (id) { return $(id).style; }; var ajax = function(sURL, fnHandler){ var xmlhttp; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { xmlhttp = new XMLHttpRequest(); } catch (e) { return null; }}} try { xmlhttp.onreadystatechange = function(){ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) fnHandler(xmlhttp.responseText); }; xmlhttp.open("GET", sURL, true); xmlhttp.send(""); } catch(z) { return null; } } String.prototype.matchOf = function(sValue){ return (this.toUpperCase().indexOf(sValue.toUpperCase()) >= 0); } var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; } function addEventHandler(oTarget, sEventType, fnHandler) { if (oTarget.addEventListener) { oTarget.addEventListener(sEventType, fnHandler, false); } else if (oTarget.attachEvent) { oTarget.attachEvent("on" + sEventType, fnHandler); } else { oTarget["on" + sEventType] = fnHandler; } }; function removeEventHandler(oTarget, sEventType, fnHandler) { if (oTarget.removeEventListener) { oTarget.removeEventListener(sEventType, fnHandler, false); } else if (oTarget.detachEvent) { oTarget.detachEvent("on" + sEventType, fnHandler); } else { oTarget["on" + sEventType] = null; } }; function Event(e){ var oEvent = isIE ? window.event : e; if (isIE) { oEvent.target = oEvent.srcElement; oEvent.pageX = oEvent.clientX + document.documentElement.scrollLeft; oEvent.pageY = oEvent.clientY + document.documentElement.scrollTop; oEvent.preventDefault = function () { this.returnValue = false; }; oEvent.detail = oEvent.wheelDelta / (-40); } return oEvent; } function SetSelects(css) { selects = document.getElementsByTagName("select"); var len = selects.length; for (i = 0; i != len; i++) selects[i].style.visibility = css; }


    picview.js
    JScript code
    var PicView = Class.create(); PicView.prototype = { initialize: function(idDiv, iWidth, iHeight) { var oPicView = this, oDiv = document.getElementById(idDiv); iWidth = iWidth > 0 ? iWidth : 100; iHeight = iHeight > 0 ? iHeight : 100; //div oDiv.style.filter = "Alpha(100)"; oDiv.style.cursor = "pointer"; oDiv.style.overflow = "hidden"; oDiv.align = "center"; oDiv.style.width = iWidth + "px"; oDiv.style.height = iHeight + "px"; this.oDiv = oDiv; this.iDiffX = 0; this.iDiffY = 0; this.timer = null; this.isDrag = false; this.DefaultWidth = iWidth; this.DefaultHeight = iHeight; this.iCount = 0; if (isIE){ oDiv.ondrag = function(){ return false; }; oDiv.onmousewheel = function(){ oPicView.MouseCtrl(); }; } else { addEventHandler(oDiv, "DOMMouseScroll", function(e){ oPicView.MouseCtrl(e); }); }; oDiv.onmousedown = function(e){ oPicView.MouseDown(e); return false; }; addEventHandler(document.body, "mousemove", function(e){ oPicView.MouseMove(e); }); addEventHandler(document.body, "mouseup", function(){ oPicView.MouseUp(); }); }, // Load: function(sUrl){ if ("" == sUrl || null == sUrl) return; var imgTemp = new Image(), i = ++this.iCount, oPicView = this; imgTemp.onload = function(){ if(i < oPicView.iCount) return; var oDiv = oPicView.oDiv, oImg = document.createElement("img"); if (oPicView.oImg) oDiv.removeChild(oPicView.oImg); oPicView.oImg = oImg; oPicView.iChange = 0; oDiv.style.paddingTop = "0px"; oDiv.style.height = oPicView.DefaultHeight + "px"; oDiv.scrollTop = oDiv.scrollLeft = 0; oImg.onload = function(){ oPicView.iOriginal = oImg.width; oPicView.iIratio = oImg.width / oImg.height; oPicView.Default(); oDiv.appendChild(oImg); } oPicView.oImg.src = sUrl; } imgTemp.src = sUrl; }, // SetPic: function(iZoom){ var oImg = this.oImg, oDiv = this.oDiv, iWidth = oImg.width + iZoom, iHeight = iWidth / this.iIratio, iSpacing = this.DefaultHeight - iHeight; oImg.width = iWidth; oImg.height = iHeight; // if (iSpacing > 0) { iSpacing /= 2; oDiv.style.paddingTop = iSpacing + "px"; oDiv.style.height = this.DefaultHeight - iSpacing + "px"; } else { oDiv.style.paddingTop = "0px"; oDiv.style.height = this.DefaultHeight + "px"; }; // oDiv.scrollLeft += iZoom * (oDiv.scrollLeft + this.DefaultWidth / 2) / iWidth; oDiv.scrollTop += iZoom * (oDiv.scrollTop + this.DefaultHeight / 2) / iHeight; }, // ZoomIn: function(){ clearTimeout(this.timer); if (this.oImg.width > 2048 || this.iChange++ > 20) { this.iChange = 0; return false; } this.SetPic(5); var oPicShow = this; this.timer = window.setTimeout(function(){ oPicShow.ZoomIn(); }, 10); }, // ZoomOut: function(){ clearTimeout(this.timer); if (this.oImg.width < 100 || this.iChange++ > 20) { this.iChange = 0; return false; } this.SetPic(-5); var oPicShow = this; this.timer = window.setTimeout(function(){ oPicShow.ZoomOut(); }, 10); }, // Reset: function(){ clearTimeout(this.timer); this.SetPic(this.iOriginal - this.oImg.width); }, // MouseCtrl: function(e){ clearTimeout(this.timer); var oEvent = Event(e), iZoom = 5 * oEvent.detail, iWidth = this.oImg.width - iZoom; oEvent.preventDefault(); if (iWidth > 100 && iWidth < 2048) { this.SetPic(-iZoom); }; return false; }, // Default: function(){ var iWidth = this.DefaultWidth; if ((iWidth / this.iIratio) > this.DefaultHeight) { iWidth = this.DefaultHeight * this.iIratio; } this.SetPic(iWidth - this.oImg.width); }, // MouseDown: function(e){ clearTimeout(this.timer); var oEvent = Event(e); this.iDiffX = oEvent.pageX; this.iDiffY = oEvent.pageY; this.isDrag = true; }, MouseMove: function(e){ if (!this.isDrag) return; var oEvent = Event(e); this.oDiv.scrollTop += this.iDiffY - oEvent.pageY; this.oDiv.scrollLeft += this.iDiffX - oEvent.pageX; this.iDiffX = oEvent.pageX; this.iDiffY = oEvent.pageY; }, MouseUp: function(){ this.isDrag = false; } };
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-06-11 13:51:554楼 得分:0
    不错不错!!!太谢谢你了!!只不过 就是没有那个拖拽 如果有 就OK了
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-06-11 13:54:405楼 得分:0
    哦 有了 必须 放大 才有!!!OK  very good!!!!!!!!!
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-06-12 16:41:426楼 得分:0
    晕啊 需求变了
    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    北京创新乐知广告有限公司 版权所有 京 ICP 证 070598 号
    世纪乐知(北京)网络技术有限公司 提供技术支持
    Copyright © 2000-2008, CSDN.NET, All Rights Reserved