例子: var _ppoints = [ new BMap.Point(120.220588,30.26135), new BMap.Point(120.218863,30.258449), new BMap.Point(120.222618,30.256702), new BMap.Point(120.224748,30.25926), new BMap.Point(120.220588,30.26135)]; var pppoint = new BMap.Point(120.222043,30.259197); var result = BMapLib.GeoUtils.isPointInPolygon(pppoint, _ppolygon); alert("result:"+result);
#2547
#2548
<?php /** * @author 至尊王者 * @author Link http://home.cnblogs.com/u/flying_bat/ * @developer Zjmainstay * @developer Link http://www.zjmainstay.cn * @usage * MysqlDump::dbDump('localhost', 'zjmainstay', '', 'test', 't_trade', 'tmp.sql'); */ class MysqlDump { /** * 数据库内容导出 * @param $host database host * @param $user username * @param $pwd password * @param $db database name * @param $table only dump one table * @param $filename custom file to write output content */ public static function dbDump($host, $user, $pwd, $db, $table = null, $filename = null) { $mysqlconlink = mysql_connect($host, $user, $pwd, true); if (!$mysqlconlink) echo sprintf('No MySQL connection: %s',mysql_error())."<br/>"; mysql_set_charset( 'utf8', $mysqlconlink ); $mysqldblink = mysql_select_db($db,$mysqlconlink); if (!$mysqldblink) echo sprintf('No MySQL connection to database: %s',mysql_error())."<br/>"; $tabelstobackup = array(); $result = mysql_query("SHOW TABLES FROM `$db`"); if (!$result) echo sprintf('Database error %1$s for query %2$s', mysql_error(), "SHOW TABLE STATUS FROM `$db`;")."<br/>"; while ($data = mysql_fetch_row($result)) { if(empty($table)) { $tabelstobackup[] = $data[0]; } else if(strtolower($data[0]) == strtolower($table)){ //only dump one table $tabelstobackup[] = $data[0]; break; } } if (count($tabelstobackup)>0) { $result=mysql_query("SHOW TABLE STATUS FROM `$db`"); if (!$result) echo sprintf('Database error %1$s for query %2$s', mysql_error(), "SHOW TABLE STATUS FROM `$db`;")."<br/>"; while ($data = mysql_fetch_assoc($result)) { $status[$data['Name']]=$data; } if(!isset($filename)) { $date = date('YmdHis'); $filename = "{$db}.{$date}.sql"; } if ($file = fopen($filename, 'wb')) { fwrite($file, "-- ---------------------------------------------------------\n"); fwrite($file, "-- Database Name: $db\n"); if(empty($table)) { //if not only dump single table, dump database create sql self::_db_dump_create_database($db, $file); } fwrite($file, "-- ---------------------------------------------------------\n\n"); fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n"); fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n"); fwrite($file, "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n"); fwrite($file, "/*!40101 SET NAMES '".mysql_client_encoding()."' */;\n"); fwrite($file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n"); fwrite($file, "/*!40103 SET TIME_ZONE='".mysql_result(mysql_query("SELECT @@time_zone"),0)."' */;\n"); fwrite($file, "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n"); fwrite($file, "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n"); fwrite($file, "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n"); fwrite($file, "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n\n"); foreach($tabelstobackup as $table) { echo sprintf('Dump database table "%s"',$table)."<br/>"; self::need_free_memory(($status[$table]['Data_length']+$status[$table]['Index_length'])*3); self::_db_dump_table($table,$status[$table],$file); } fwrite($file, "\n"); fwrite($file, "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;\n"); fwrite($file, "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n"); fwrite($file, "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n"); fwrite($file, "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n"); fwrite($file, "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n"); fwrite($file, "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"); fwrite($file, "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n"); fwrite($file, "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n"); fclose($file); echo 'Database dump done!'."<br/>"; } else { echo 'Can not create database dump!'."<br/>"; } } else { echo 'No tables to dump'."<br/>"; } } protected static function _db_dump_create_database($dbname, $file) { $sql = "SHOW CREATE DATABASE `".$dbname."`"; $result=mysql_query($sql); if (!$result) { echo sprintf('Database error %1$s for query %2$s', mysql_error(), $sql)."<br/>"; return false; } $dbstruc=mysql_fetch_assoc($result); fwrite($file, str_ireplace('CREATE DATABASE', 'CREATE DATABASE IF NOT EXISTS', $dbstruc['Create Database']).";\n"); fwrite($file, "USE `{$dbname}`;\n"); } protected static function _db_dump_table($table,$status,$file) { fwrite($file, "\n"); fwrite($file, "--\n"); fwrite($file, "-- Table structure for table $table\n"); fwrite($file, "--\n\n"); fwrite($file, "DROP TABLE IF EXISTS `" . $table . "`;\n"); fwrite($file, "/*!40101 SET @saved_cs_client = @@character_set_client */;\n"); fwrite($file, "/*!40101 SET character_set_client = '".mysql_client_encoding()."' */;\n"); $result=mysql_query("SHOW CREATE TABLE `".$table."`"); if (!$result) { echo sprintf('Database error %1$s for query %2$s', mysql_error(), "SHOW CREATE TABLE `".$table."`")."<br/>"; return false; } $tablestruc=mysql_fetch_assoc($result); fwrite($file, $tablestruc['Create Table'].";\n"); fwrite($file, "/*!40101 SET character_set_client = @saved_cs_client */;\n"); $result=mysql_query("SELECT * FROM `".$table."`"); if (!$result) { echo sprintf('Database error %1$s for query %2$s', mysql_error(), "SELECT * FROM `".$table."`")."<br/>"; return false; } fwrite($file, "--\n"); fwrite($file, "-- Dumping data for table $table\n"); fwrite($file, "--\n\n"); if ($status['Engine']=='MyISAM') fwrite($file, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n"); while ($data = mysql_fetch_assoc($result)) { $keys = array(); $values = array(); foreach($data as $key => $value) { if($value === NULL) $value = "NULL"; elseif($value === "" or $value === false) $value = "''"; elseif(!is_numeric($value)) $value = "'".mysql_real_escape_string($value)."'"; $values[] = $value; } fwrite($file, "INSERT INTO `".$table."` VALUES ( ".implode(", ",$values)." );\n"); } if ($status['Engine']=='MyISAM') fwrite($file, "/*!40000 ALTER TABLE ".$table." ENABLE KEYS */;\n"); } protected static function need_free_memory($memneed) { if (!function_exists('memory_get_usage')) return; $needmemory=@memory_get_usage(true) + self::inbytes($memneed); if ($needmemory > self::inbytes(ini_get('memory_limit'))) { $newmemory=round($needmemory/1024/1024)+1 .'M'; if ($needmemory>=1073741824) $newmemory=round($needmemory/1024/1024/1024) .'G'; if ($oldmem=@ini_set('memory_limit', $newmemory)) echo sprintf('Memory increased from %1$s to %2$s','backwpup',$oldmem,@ini_get('memory_limit'))."<br/>"; else echo sprintf('Can not increase memory limit is %1$s','backwpup',@ini_get('memory_limit'))."<br/>"; } } protected static function inbytes($value) { $multi = strtoupper(substr(trim($value), -1)); $bytes = abs((int)trim($value)); if ($multi=='G') $bytes=$bytes*1024*1024*1024; if ($multi=='M') $bytes=$bytes*1024*1024; if ($multi=='K') $bytes=$bytes*1024; return $bytes; } } //highlight_file highlight_file(__FILE__);
#2549
onclick的事件被先执行,其次是href中定义的(页面跳转或者javascript)
同时存在两个定义的时候(onclick与href都定义了),如果想阻止href的动作,在onclick必须加上return false;
在href中定义的函数如果有返回值的话,当前页面的内容将被返回值代替。
A标签触发onclick事件而不跳转
<a href="#" onclick="return test();">href onclick</a> <script> function test(){ //alert('teswt'); return false; //return true; } </script>
#2550
分页手机版本问题移动设备li
<?php $pages= str_ireplace('</a>','</a></li>',$pages); $pages= str_ireplace('<a','<li style="display: inline-block;"><a',$pages);
#2551
说明:本文档兼容性测试基础环境为:windows系统;IE6-IE10, Firefox6.0, Chrome13.0, Safari5.1, Opera11.51
Bugs及解决方案列表(以下实例默认运行环境都为Standard mode):
如何在IE6及更早浏览器中定义小高度的容器?
方法:
#test{overflow:hidden;height:1px;font-size:0;line-height:0;}
IE6及更早浏览器之所以无法直接定义较小高度的容器是因为默认会有行高
如何解决IE6及更早浏览器浮动时产生双倍边距的BUG?
方法:
#test{display:inline;}
当在IE6及更早浏览器中出现浮动后margin值解析为双倍的情况,设置该元素的display属性为inline即可。
如何在IE6及更早浏览器下模拟min-height效果?
方法:
#test{min-height:100px;_height:100px;}
注意此时#test不能再设置overflow的值为hidden,否则模拟min-height效果将失效
如何解决按钮在IE7及更早浏览器下随着value增多两边留白也随着增加的问题?
方法:
input,button{overflow:visible;}
如何解决IE7及更早浏览器下当li中出现2个或以上的浮动时,li之间产生的空白间隙的BUG?
方法:
li{vertical-align:top;}
除了top值,还可以设置为text-top | middle | bottom | text-bottom,甚至特定的<length>和<percentage>值都可以
如何解决IE6及更早浏览器下的3像素BUG?
方法:
.a{color:#f00;}
.main{width:950px;background:#eee;}
.content{float:left;width:750px;height:100px;background:#ccc;_margin-right:-3px;}
.aside{height:100px;background:#aaa;}
<div class="main">
<div class="content">content</div>
<div class="aside">aside</div>
</div>
在IE6及更早浏览器下为.content设置margin-right:-3px;也可以设置.aside为浮动
如何解决IE6下的文本溢出BUG(江湖匪号:“谍影重重”或“一只猪的故事”)?
BUG重现:
.test{zoom:1;overflow:hidden;width:500px;}
.box1{float:left;width:100px;}
.box2{float:right;width:400px;}
<div class="test">
<div class="box1"></div>
<!-- 注释 -->
<div class="box2">↓这就是多出来的那只猪</div>
</div>
运行如上代码,你会发现文字发生了溢出,在IE6下会多出一只“猪”。造成此BUG的原因可能是多重混合的,如浮动,注释,宽高定义等等。并且注释条数越多,溢出的文本也会随之增多。
列举几个解决方法:
删除box1和box2之间所有的注释;
不设置浮动;
调整box1或box2的宽度,比如将box的宽度调整为90px
如何解决IE6使用滤镜PNG图片透明后,容器内链接失效的问题?
方法:
div{width:300px;height:100px;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='*.png');}
a{_position:relative;}
解决方法是为容器内的链接定义相对定位属性position的值为relative
如何解决IE6无法识别伪对象:first-letter/:first-line的问题?
方法1:
p:first-letter {float:left;font-size:40px;font-weight:bold;}
p:first-line {color:#090;}
增加空格:在伪对象选择符:first-letter/:first-line与包含规则的花括号"{"间增加空格。
方法2:
p:first-letter
{float:left;font-size:40px;font-weight:bold;}
p:first-line
{color:#090;}
换行:将整个花括号"{"规则区域换行。细节参见E:first-letter和E:first-line选择符
如何解决IE8会忽略伪对象:first-letter/:first-line里的!important规则的问题?
BUG重现:
p:first-letter {float:left;font-size:40px;font-weight:bold;color:#f00!important;color:#090;}
如上代码,在IE8下color定义都会失效,原因就是因为有color使用了!important规则。鉴于此,请尽量不要在:first-letter/:first-line里使用!important规则。
如何解决IE6会忽略同一条样式体内的!important规则的问题?
BUG重现:
div{color:#f00!important;color:#000;}
如上代码,IE6及以下浏览器div的文本颜色为#000,!important并没有覆盖后面的规则,也就是说!important被忽略了。解决方案是将该样式拆分为2条,细节参见!important规则
如何解决IE6及更早浏览器下当li内部元素是定义了display:block的内联元素时底部产生空白的问题?
BUG重现:
a,span{display:block;background:#ddd;}
<ul>
<li><a href="../">CSS参考手册</a></li>
<li><a href="../">CSS探索之旅</a></li>
<li><a href="../">web前端实验室</a></li>
<li><span>测试li内部元素为设置了display:block的内联元素时底部产生空白</span></li>
</ul>
如上代码,IE6及更早浏览器每个li内部的内联元素底部都会产生空白。解决方案是给li内部的内联元素再加上zoom:1
如何解决IE6及更早浏览器下未定义宽度的浮动或绝对定位元素会被内部设置了zoom:1的块元素撑开的问题?
BUG重现:
#test{zoom:1;overflow:hidden;border:1px solid #ddd;background:#eee;}
#test h1{float:left;}
#test .nav{float:right;background:#aaa;}
#test .nav ul{zoom:1;overflow:hidden;margin:0;padding:0;list-style:none;}
#test .nav li{float:left;margin:0 5px;}
<div id="test">
<h1>Doyoe</h1>
<div class="nav">
<ul>
<li><a href="../">CSS参考手册</a></li>
<li><a href="../">CSS探索之旅</a></li>
<li><a href="../">web前端实验室</a></li>
</ul>
</div>
</div>
如上代码,IE6及更早浏览器div.nav会被设置了zoom:1的ul给撑开。
列举几个解决方法:
设置ul为浮动元素;
设置ul为inline元素;
设置ul的width
如何解决IE7及更早浏览器下子元素相对定位时父元素overflow属性的auto|hidden失效的问题?
BUG重现:
div{overflow:auto;width:260px;height:80px;border:1px solid #ddd;}
p{position:relative;margin:0;}
<div>
<p>如果我是相对定位,我的父元素overflow属性设置为auto|hidden将失效。如果你使用的是IE及更早浏览器,你将可以看到这个BUG</p>
<p>如果我是相对定位,我的父元素overflow属性设置为auto|hidden将失效。如果你使用的是IE及更早浏览器,你将可以看到这个BUG</p>
</div>
如上代码,在IE7及更早浏览器下你会看到div的滚动条将无法工作。解决方案是给div也设置相对定位position:relative
如何解决Chrome在应用transition时页面闪动的问题?
方法:
-webkit-transform-style:preserve-3d;或-webkit-backface-visibility:hidden;
在Chrome下,使用过渡效果transition时有时会出现页面闪动
#2552
说明:本文档兼容性测试基础环境为:windows系统;IE6-IE10, Firefox6.0, Chrome13.0, Safari5.1, Opera11.51
其它技巧和经验列表(以下实例默认运行环境都为Standard mode):
如何让层在falsh上显示?
方法:
<param name="wmode" value="transparent" />
设置flash的wmode值为transparent或opaque
如何使用标准的方法在页面上插入flash?
方法:
<object id="flash-show" type="application/x-shockwave-flash" data="*.swf">
<param name="movie" value="*.swf" />
<param name="wmode" value="transparent" />
<img src="*.jpg" alt="用于不支持flash或屏蔽flash时显示" />
</object>
至于flash的宽高可以在css里设置
如何在点文字时也选中复选框或单选框?
方法1:
<input type="checkbox" id="chk1" name="chk" /><label for="chk1">选项一</label>
<input type="checkbox" id="chk2" name="chk" /><label for="chk2">选项二</label>
<input type="radio" id="rad1" name="rad" /><label for="rad1">选项一</label>
<input type="radio" id="rad2" name="rad" /><label for="rad2">选项二</label>
该方式所有主流浏览器都支持
方法2:
<label><input type="checkbox" name="chk" />选项一</label>
<label><input type="checkbox" name="chk" />选项二</label>
<label><input type="radio" name="rad" />选项一</label>
<label><input type="radio" name="rad" />选项二</label>
该方式相比方法1更简洁,但IE6及更早浏览器不支持
IE下如何对Standard Mode与Quirks Mode进行切换?
IE6的触发(在DTD申明前加上XML申明):
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
IE5.5及更早浏览器版本直接以Quirks Mode解析。
所有IE版本的触发(在DTD申明前加上HTML注释):
<!-- Let IE into quirks mode -->
<!DOCTYPE html>
当没有DTD声明时,所有IE版本也会进入Quirks Mode。
如何区别display:none与visibility:hidden?
方法:
相同的是display:none与visibility:hidden都可以用来隐藏某个元素; 不同的是display:none在隐藏元素的时候,将其占位空间也去掉;而visibility:hidden只是隐藏了内容而已,其占位空间仍然保留。
如何设置IE下的iframe背景透明?
方法:
设置iframe元素的标签属性allowtransparency="allowtransparency"然后设置iframe内部页面的body背景色为transparent。 不过由此会引发IE下一些其它问题,如:设置透明后的iframe将不能遮住select
#2553
js随机函数
#2554
session_name('MANAGER');
session_start();
19. 使用str_replace取代preg_replace 。使用strtr代替str_replace
为啥不能用行if?? $a && ++$a_count;呢
#2555
div高度比图片高度大。
原因:img是inline元素,有假想元素。基于baseline定位时,父容器高度为假想元素的下半部分高度+图片高度。
解决方法:即消除假想元素影响。可以是 img { display: block; }; 可以是 div { line-height: 0}; 可以是img { vertical-align: middle//也可以是其他值 }; 可以是 div { font-size: 0};
#2556
#2557
BMapLib.GeoUtils.isPointInPolygon(point, polygon) Boolean
判断点是否多边形内
例子:
var _ppoints = [
new BMap.Point(120.220588,30.26135),
new BMap.Point(120.218863,30.258449),
new BMap.Point(120.222618,30.256702),
new BMap.Point(120.224748,30.25926),
new BMap.Point(120.220588,30.26135)];
var pppoint = new BMap.Point(120.222043,30.259197);
var result = BMapLib.GeoUtils.isPointInPolygon(pppoint, _ppolygon);
alert("result:"+result);
返回结果为 true;
另外我查找api ,判断一个点是否在可视范围内,
BMapLib.GeoUtils.isPointInRect(point, bounds) Boolean
判断点是否在矩形内
不管我怎么调,都是报错,报lng不存在,请遇到类似问题的兄弟指点一下。
#2558
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>GeoUtils示例</title> <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script> <script type="text/javascript" src="http://api.map.baidu.com/library/GeoUtils/1.2/src/GeoUtils_min.js"></script> <style type="text/css"> table { font-size: 14px; } </style> </head> <body> <div style="float:left;width:600px;height:500px;border:1px solid gray" id="container"></div> <div style="float:left;width:300px;height:500px;border:1px solid gray" id="control"> <table style="width:100%;"> <tr> <td colspan="2">判断点是否在多边形内:</td> </tr> <tr> <td><input type="button" value="多边形1" onclick="polygon1()" /></td> </tr> <tr> <td><input type="button" value="多边形2" onclick="polygon2()" /></td> </tr> <tr> <td>经度<input type="text" value="" id="lng"></td> </tr> <tr> <td>纬度<input type="text" value="" id="lat"></td> </tr> <tr> <td>结果:</td> </tr> <tr> <td><p id="result" style="color:red"></p></td> </tr> <table> </div> </body> </html> <script type="text/javascript"> var map = new BMap.Map("container"); var pt = new BMap.Point(116.404, 39.915); var mkr = new BMap.Marker(pt); var ply; //多边形 map.centerAndZoom(pt, 16); map.enableScrollWheelZoom(); //开启滚动缩放 map.enableContinuousZoom(); //开启缩放平滑 //初始化为多边形1 polygon1(); //生成多边形1 function polygon1() { var pts = []; var pt1 = new BMap.Point(116.395, 39.910); var pt2 = new BMap.Point(116.394, 39.914); var pt3 = new BMap.Point(116.403, 39.920); var pt4 = new BMap.Point(116.402, 39.914); var pt5 = new BMap.Point(116.410, 39.913); pts.push(pt1); pts.push(pt2); pts.push(pt3); pts.push(pt4); pts.push(pt5); ply = new BMap.Polygon(pts); //演示:将面添加到地图上 map.clearOverlays(); map.addOverlay(ply); } //生成多边形2 function polygon2() { var pts = []; var pt1 = new BMap.Point(116.395, 39.910); var pt2 = new BMap.Point(116.394, 39.914); var pt3 = new BMap.Point(116.396, 39.919); var pt4 = new BMap.Point(116.406, 39.920); var pt5 = new BMap.Point(116.410, 39.913); pts.push(pt1); pts.push(pt2); pts.push(pt3); pts.push(pt4); pts.push(pt5); ply = new BMap.Polygon(pts); //演示:将多边形添加到地图上 map.clearOverlays(); map.addOverlay(ply); } //map.addEventListener("click", function (e) { mkr.setPosition(map.addEventListener.point); map.addOverlay(mkr); //将点击的点的坐标显示在页面上 document.getElementById("lng").value = '116.410926';//e.point.lng; document.getElementById("lat").value = '39.917089';//e.point.lat; InOrOutPolygon('116.410926', '39.917089'); //}); function InOrOutPolygon(lng, lat){ var pt = new BMap.Point(lng, lat); var result = BMapLib.GeoUtils.isPointInPolygon(pt, ply); if (result == true) { document.getElementById("result").innerHTML = "点在多边形内"; } else { document.getElementById("result").innerHTML = "点在多边形外"; } } </script>
#2559
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible"content="IE=edge,chrome=1"/> <title>百度地图获取经纬度标注 lizhenqiu.com</title> <style> #map_container { width: 1005px; margin: 0 auto; } #rMap { width: 600px; height: 500px; float: left; } #lSearch { width: 300px; height: 500px; float: left; } td { width: 100px; } </style> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"src="http://api.map.baidu.com/api?v=1.3"></script> <script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script> <link rel="stylesheet"href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css"/> </head> <body> lng<input type="text"id="longitude" /> lat<input type="text"id="latitude" /> <div class="bg_cover"></div> <div id="map_container"> <div id="rMap"></div> </div> <script> $(function () { var map = new BMap.Map("rMap");//创建地图实例 var point = new BMap.Point(108.330585, 22.815506);//初始设置地图中心点,为天安门 map.addControl(new BMap.MapTypeControl()); //添加地图类型控件 map.setCurrentCity("金外滩大厦"); map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用 map.centerAndZoom(point, 15); creatMarker(); //$("#btnSearch").click(function () { var txt = '南宁市中山路66号金外滩商务大厦1301';//$(".txtProvince").val() + $(".txtCity").val() + $(".txtDetail").val(); var lng, lat; if (txt !="") { var localSearch = new BMap.LocalSearch(map); map.clearOverlays();//清空原来的标注 localSearch.setSearchCompleteCallback(function (searchResult) { var poi = searchResult.getPoi(0); lng = poi.point.lng; lat = poi.point.lat; map.centerAndZoom(poi.point, 15); point = new BMap.Point(poi.point.lng, poi.point.lat); creatMarker(); }); localSearch.search(txt); } //}) //创建地图遮盖物 function creatMarker() { var marker = new BMap.Marker(point); // 创建标注 map.addOverlay(marker); // 将标注添加到地图中 marker.enableDragging(); //标注可拖拽 /* marker.addEventListener("click", function (e) { searchInfoWindow.open(marker); })*/ //marker.addEventListener("dragend", function (e) { //监听标注的dragend事件,获取拖拽后地理坐标 $("#longitude").val(marker.point.lng); $("#latitude").val(marker.point.lat); var pt = marker.point; //}) /* var label = new BMap.Label("广西南宁青秀区金外滩商务大厦", {offset: new BMap.Size(20, -10)}); marker.setLabel(label); map.addOverlay(marker); //在地图中添加marker marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画*/ }; }) </script> </body> </html>
#2560
我盯着EXIT不禁陷入了沉思
#2561
#2562
#2563
#2564
#2565
wp_auth_group_access 所在用户组
wp_manager 公众号
wp_manager_menu
wp_public
wp_public_auth
wp_public_follow 关注用户
wp_public_group
wp_public_link