一个按钮交替单击,作用不同,toggle方法
<script>导入JS库</script>
?
<input value="测试 拉框" id="drag" type="button"/>
<script>
//这是百度地图的方法;
var myDrag = new BMapLib.RectangleZoom(map, {
??? ??? ??? ??? ??? ??? followText: "拖拽鼠标进行操作"
??? ??? ??? ??? ??? ??? ??? });
??? ??? ??? ??? ??? ??? ???
??? ??? ??? ?? $("#drag").toggle(
??? ??? ??? ????? function () {
??? ??? ??? ????? ??? ?alert("hello1");???? //测试
??? ??? ??? ?????? ? ? myDrag.open();? //开启拉框放大???
??? ??? ??? ????? },
??? ??? ??? ????? function () {
??? ??? ??? ????? ?? ? alert("hello2");
??? ??? ??? ????? ? ? myDrag.close();? //关闭拉框放大
??? ??? ??? ???? //?? $(this).myDrag.close();? //关闭拉框放大
??? ??? ??? ????? }
??? ??? ??? ??? );
</srcipt>