当前位置: 58彩票app下载 > 计算机网络 > 正文

中控件值,静态地图API实现代码

时间:2019-09-18 11:14来源:计算机网络
复制代码 代码如下: [html] table style="width: 100%; height: 100%" border="1"              caption                  Material/Special Tool Rental/ToolCantainer/Transportation/Mobile/caption          

复制代码 代码如下:

[html]
<table style="width: 100%; height: 100%" border="1"> 
            <caption> 
                Material/Special Tool Rental/Tool Cantainer/Transportation/Mobile</caption> 
            <tbody><tr> 
                <td> 
                    Project No 
                </td> 
                <td> 
                    <input type="hidden" name="hidProjectInnerID" id="hidProjectInnerID"> 
                    <input name="txtProjectNo" type="text" id="txtProjectNo" class="Error"><a href="javascript:void(0)" onclick="SelectProject();">选择</a> 
                </td> 
                <td> 
                    Final Custome: 
                </td> 
                <td> 
                    <span id="labFinalCustome">Label</span> 
                </td> 
                <td> 
                    Order No. 
                </td> 
                <td> 
                    <span id="labOrderNo">Label</span> 
                </td> 
                <td> 
                    Project Leaing Time: 
                </td> 
                <td> 
                    <span id="labProjectLeaingTime">Label</span> 
                </td> 
            </tr> 
            <tr> 
                <td colspan="8"> 
                    Exchange Rate:8.3000 
                </td> 
            </tr> 
            <tr align="center"> 
                <td> 
                    item 
                </td> 
                <td colspan="2"> 
                    Description 
                </td> 
                <td> 
                    QTY 
                </td> 
                <td> 
                    Unit 
                </td> 
                <td> 
                    Total 
                </td> 
                <td> 
                    Remark 
                </td> 
                <td> 
                    <a id="NewItem" href="javascript:void(0)">NewItem</a> 
                </td> 
            </tr> 
            </tbody><tbody id="tbItem"> 
                <tr align="center"> 
                    <td> 
                    </td> 
                    <td colspan="2"> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                          
                    </td> 
                </tr> 
            <tr id="tbItem1" align="center"><td><select id="selItem" name="Item"><option value="Material">Material</option><option value="Mobile">Mobile</option><option value="Others">Others</option><option value="SpecialToolRental">Special Tool Rental</option><option value="ToolContainer">Tool Container</option><option value="Transportation">Transportation</option><option value="WorkingHours">WorkingHours</option></select></td><td colspan="2"><input id="txtDescription" style="width:90%" type="text" name="Item"></td><td><input id="txtQTY" type="text" name="Item"></td><td><input id="txtUnit" type="text" name="Item"></td><td><input id="txtTotal" type="text" name="Item"></td><td><input id="txtRemark" type="text" name="Item"></td><td><a href="javascript:;SaveItem('tbItem1')">保存</a> | <a href="javascript:;DelItem('tbItem1')">删除</a> <input id="txtInnerID" type="hidden" name="Item"></td></tr></tbody> 
        </table> 

<!DOCTYPE html>
<html>
<head>
<title>Google 静态地图 API</title>
<style type="text/css">
#divStaticMap span
{
color:Gray;
font-size:12px;
}
#divStaticMap .sel
{
width:130px;
}
</style>
<script type="text/javascript">
function getObj(id) {
return document.getElementById(id);
}

<table style="width: 100%; height: 100%" border="1">
            <caption>
                Material/Special Tool Rental/Tool Cantainer/Transportation/Mobile</caption>
            <tbody><tr>
                <td>
                    Project No
                </td>
                <td>
                    <input type="hidden" name="hidProjectInnerID" id="hidProjectInnerID">
                    <input name="txtProjectNo" type="text" id="txtProjectNo" class="Error"><a href="javascript:void(0)" onclick="SelectProject();">选择</a>
                </td>
                <td>
                    Final Custome:
                </td>
                <td>
                    <span id="labFinalCustome">Label</span>
                </td>
                <td>
                    Order No.
                </td>
                <td>
                    <span id="labOrderNo">Label</span>
                </td>
                <td>
                    Project Leaing Time:
                </td>
                <td>
                    <span id="labProjectLeaingTime">Label</span>
                </td>
            </tr>
            <tr>
                <td colspan="8">
                    Exchange Rate:8.3000
                </td>
            </tr>
            <tr align="center">
                <td>
                    item
                </td>
                <td colspan="2">
                    Description
                </td>
                <td>
                    QTY
                </td>
                <td>
                    Unit
                </td>
                <td>
                    Total
                </td>
                <td>
                    Remark
                </td>
                <td>
                    <a id="NewItem" href="javascript:void(0)">NewItem</a>
                </td>
            </tr>
            </tbody><tbody id="tbItem">
                <tr align="center">
                    <td>
                    </td>
                    <td colspan="2">
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                        
                    </td>
                </tr>
            <tr id="tbItem1" align="center"><td><select id="selItem" name="Item"><option value="Material">Material</option><option value="Mobile">Mobile</option><option value="Others">Others</option><option value="SpecialToolRental">Special Tool Rental</option><option value="ToolContainer">Tool Container</option><option value="Transportation">Transportation</option><option value="WorkingHours">WorkingHours</option></select></td><td colspan="2"><input id="txtDescription" style="width:90%" type="text" name="Item"></td><td><input id="txtQTY" type="text" name="Item"></td><td><input id="txtUnit" type="text" name="Item"></td><td><input id="txtTotal" type="text" name="Item"></td><td><input id="txtRemark" type="text" name="Item"></td><td><a href="javascript:;SaveItem('tbItem1')">保存</a> | <a href="javascript:;DelItem('tbItem1')">删除</a> <input id="txtInnerID" type="hidden" name="Item"></td></tr></tbody>
        </table>[javascript] view plaincopyprint?function SaveItem(index) { 
            var tr = $("tr[id=" + index + "]"); 
            var innerid = tr.find('input[ID$=txtInnerID]').val(); 
            var item = tr.find("select[id*=selItem]").val(); 
            var des = tr.find('input[ID$=txtDescription]').val(); 
            var qty = tr.find('input[ID$=txtQTY]').val(); 
            var unit = tr.find('input[ID$=txtUnit]').val(); 
            var total = tr.find('input[ID$=txtTotal]').val(); 
            var remark = tr.find('input[ID$=txtRemark]').val(); 
            //alert(innerid + "/" + item + des + qty + unit + total + remark);  
            //验证项目编号  
            var proinnerid = $("#hidProjectInnerID").val(); 
            if (proinnerid == "") { 
                $("#txtProjectNo").removeClass("Field"); 
                $("#txtProjectNo").addClass("Error"); 
                return false; 
            } 
            /*
            jQuery.ajax({
            type: 'get',
            url: '../Handler/ProjectReport.ashx',
            data: { "key": "save", "proinnerid": $("#hidProjectInnerID").val(), "innerid": innerid, "type": type, "content": content, "startdate": startdate, "enddate": enddate, "remark": remark },
 
            cache: false,
            success: function (result) {
            var jsonobj = eval(result);
            if (jsonobj[0].result == "true")
            alert("Sueecss");
            else
            alert("Error");
            }
            });
            */ 
        } 
        function DelItem(index) { 
            var tr = $("tr[id=" + index + "]"); 
            //var innerid = tr.find('input[ID$=txtInnerID]').val();  
            $("tr[id=" + index + "]").remove(); 
        } 

function getStaticMap() {
var url = '';
if (getObj('chkUseNum').checked) {
url += encodeURI(getObj('txtX').value) + ',' + encodeURI(getObj('txtY').value);
}
else {
url += encodeURI(getObj('txtCenter').value);
}
url += '&zoom=' + getObj('txtZoom').value;
url += '&size=' + getObj('txtWidth').value + 'x' + getObj('txtHeight').value;
url += '&format=' + getObj('selImageType').options[getObj('selImageType').selectedIndex].text;
url += '&maptype=' + getObj('selMapType').value;
var trs = getObj('tdFlagList').getElementsByTagName('tr');
for (var i = 1; i < trs.length; i++) {
var txtFlagAddress = trs[i].getElementsByTagName('input')[0];
if (txtFlagAddress.value == '') {
continue;
}
var selFlagColor = trs[i].getElementsByTagName('select')[0];
var selFlagSize = trs[i].getElementsByTagName('select')[1];
var txtFlagLabel = trs[i].getElementsByTagName('input')[1];
url += '&markers=size:' + selFlagSize.value;
url += '|color:' + selFlagColor.options[selFlagColor.selectedIndex].text;
url += '|label:' + txtFlagLabel.value;
url += '|' + encodeURI(txtFlagAddress.value);
}
url += '&sensor=false';

function SaveItem(index) {
            var tr = $("tr[id=" + index + "]");
            var innerid = tr.find('input[ID$=txtInnerID]').val();
            var item = tr.find("select[id*=selItem]").val();
            var des = tr.find('input[ID$=txtDescription]').val();
            var qty = tr.find('input[ID$=txtQTY]').val();
            var unit = tr.find('input[ID$=txtUnit]').val();
            var total = tr.find('input[ID$=txtTotal]').val();
            var remark = tr.find('input[ID$=txtRemark]').val();
            //alert(innerid + "/" + item + des + qty + unit + total + remark);
            //验证项目编号
            var proinnerid = $("#hidProjectInnerID").val();
            if (proinnerid == "") {
                $("#txtProjectNo").removeClass("Field");
                $("#txtProjectNo").addClass("Error");
                return false;
            }
            /*
            jQuery.ajax({
            type: 'get',
            url: '../Handler/ProjectReport.ashx',
            data: { "key": "save", "proinnerid": $("#hidProjectInnerID").val(), "innerid": innerid, "type": type, "content": content, "startdate": startdate, "enddate": enddate, "remark": remark },

getObj('txtImageUrl').value = url;
getObj('imgMap').src = url;
getObj('imgMap').style.display = 'block';
}

            cache: false,
            success: function (result) {
            var jsonobj = eval(result);
            if (jsonobj[0].result == "true")
            alert("Sueecss");
            else
            alert("Error");
            }
            });
            */
        }
        function DelItem(index) {
            var tr = $("tr[id=" + index + "]");
            //var innerid = tr.find('input[ID$=txtInnerID]').val();
            $("tr[id=" + index + "]").remove();
        }

function addMapFlag(o) {
var tr = o.parentNode.parentNode;
var newTr = tr.parentNode.appendChild(tr.cloneNode(true));
var aList = newTr.getElementsByTagName('a');
aList[0].style.display = 'inline';
aList[1].style.display = 'none';
newTr.getElementsByTagName('input')[0].value = '';
return false;
}

[html] view plaincopyprint?<table style="width: 100%; height: 100%" border="1"> 
            <caption> 
                Material/Special Tool Rental/Tool Cantainer/Transportation/Mobile</caption> 
            <tbody><tr> 
                <td> 
                    Project No 
                </td> 
                <td> 
                    <input type="hidden" name="hidProjectInnerID" id="hidProjectInnerID"> 
                    <input name="txtProjectNo" type="text" id="txtProjectNo" class="Error"><a href="javascript:void(0)" onclick="SelectProject();">选择</a> 
                </td> 
                <td> 
                    Final Custome: 
                </td> 
                <td> 
                    <span id="labFinalCustome">Label</span> 
                </td> 
                <td> 
                    Order No. 
                </td> 
                <td> 
                    <span id="labOrderNo">Label</span> 
                </td> 
                <td> 
                    Project Leaing Time: 
                </td> 
                <td> 
                    <span id="labProjectLeaingTime">Label</span> 
                </td> 
            </tr> 
            <tr> 
                <td colspan="8"> 
                    Exchange Rate:8.3000 
                </td> 
            </tr> 
            <tr align="center"> 
                <td> 
                    item 
                </td> 
                <td colspan="2"> 
                    Description 
                </td> 
                <td> 
                    QTY 
                </td> 
                <td> 
                    Unit 
                </td> 
                <td> 
                    Total 
                </td> 
                <td> 
                    Remark 
                </td> 
                <td> 
                    <a id="NewItem" href="javascript:void(0)">NewItem</a> 
                </td> 
            </tr> 
            </tbody><tbody id="tbItem"> 
                <tr align="center"> 
                    <td> 
                    </td> 
                    <td colspan="2"> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                    </td> 
                    <td> 
                          
                    </td> 
                </tr> 
            <tr id="tbItem1" align="center"><td><select id="selItem" name="Item"><option value="Material">Material</option><option value="Mobile">Mobile</option><option value="Others">Others</option><option value="SpecialToolRental">Special Tool Rental</option><option value="ToolContainer">Tool Container</option><option value="Transportation">Transportation</option><option value="WorkingHours">WorkingHours</option></select></td><td colspan="2"><input id="txtDescription" style="width:90%" type="text" name="Item"></td><td><input id="txtQTY" type="text" name="Item"></td><td><input id="txtUnit" type="text" name="Item"></td><td><input id="txtTotal" type="text" name="Item"></td><td><input id="txtRemark" type="text" name="Item"></td><td><a href="javascript:;SaveItem('tbItem1')">保存</a> | <a href="javascript:;DelItem('tbItem1')">删除</a> <input id="txtInnerID" type="hidden" name="Item"></td></tr></tbody> 
        </table> 

function delMapFlag(o) {
var tr = o.parentNode.parentNode;
tr.parentNode.removeChild(tr);
tr = null;
return false;
}

<table style="width: 100%; height: 100%" border="1">
            <caption>
                Material/Special Tool Rental/Tool Cantainer/Transportation/Mobile</caption>
            <tbody><tr>
                <td>
                    Project No
                </td>
                <td>
                    <input type="hidden" name="hidProjectInnerID" id="hidProjectInnerID">
                    <input name="txtProjectNo" type="text" id="txtProjectNo" class="Error"><a href="javascript:void(0)" onclick="SelectProject();">选择</a>
                </td>
                <td>
                    Final Custome:
                </td>
                <td>
                    <span id="labFinalCustome">Label</span>
                </td>
                <td>
                    Order No.
                </td>
                <td>
                    <span id="labOrderNo">Label</span>
                </td>
                <td>
                    Project Leaing Time:
                </td>
                <td>
                    <span id="labProjectLeaingTime">Label</span>
                </td>
            </tr>
            <tr>
                <td colspan="8">
                    Exchange Rate:8.3000
                </td>
            </tr>
            <tr align="center">
                <td>
                    item
                </td>
                <td colspan="2">
                    Description
                </td>
                <td>
                    QTY
                </td>
                <td>
                    Unit
                </td>
                <td>
                    Total
                </td>
                <td>
                    Remark
                </td>
                <td>
                    <a id="NewItem" href="javascript:void(0)">NewItem</a>
                </td>
            </tr>
            </tbody><tbody id="tbItem">
                <tr align="center">
                    <td>
                    </td>
                    <td colspan="2">
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                    <td>
                        
                    </td>
                </tr>
            <tr id="tbItem1" align="center"><td><select id="selItem" name="Item"><option value="Material">Material</option><option value="Mobile">Mobile</option><option value="Others">Others</option><option value="SpecialToolRental">Special Tool Rental</option><option value="ToolContainer">Tool Container</option><option value="Transportation">Transportation</option><option value="WorkingHours">WorkingHours</option></select></td><td colspan="2"><input id="txtDescription" style="width:90%" type="text" name="Item"></td><td><input id="txtQTY" type="text" name="Item"></td><td><input id="txtUnit" type="text" name="Item"></td><td><input id="txtTotal" type="text" name="Item"></td><td><input id="txtRemark" type="text" name="Item"></td><td><a href="javascript:;SaveItem('tbItem1')">保存</a> | <a href="javascript:;DelItem('tbItem1')">删除</a> <input id="txtInnerID" type="hidden" name="Item"></td></tr></tbody>
        </table>[javascript] view plaincopyprint?function SaveItem(index) { 
            var tr = $("tr[id=" + index + "]"); 
            var innerid = tr.find('input[ID$=txtInnerID]').val(); 
            var item = tr.find("select[id*=selItem]").val(); 
            var des = tr.find('input[ID$=txtDescription]').val(); 
            var qty = tr.find('input[ID$=txtQTY]').val(); 
            var unit = tr.find('input[ID$=txtUnit]').val(); 
            var total = tr.find('input[ID$=txtTotal]').val(); 
            var remark = tr.find('input[ID$=txtRemark]').val(); 
            //alert(innerid + "/" + item + des + qty + unit + total + remark);  
            //验证项目编号  
            var proinnerid = $("#hidProjectInnerID").val(); 
            if (proinnerid == "") { 
                $("#txtProjectNo").removeClass("Field"); 
                $("#txtProjectNo").addClass("Error"); 
                return false; 
            } 
            /*
            jQuery.ajax({
            type: 'get',
            url: '../Handler/ProjectReport.ashx',
            data: { "key": "save", "proinnerid": $("#hidProjectInnerID").val(), "innerid": innerid, "type": type, "content": content, "startdate": startdate, "enddate": enddate, "remark": remark },
 
            cache: false,
            success: function (result) {
            var jsonobj = eval(result);
            if (jsonobj[0].result == "true")
            alert("Sueecss");
            else
            alert("Error");
            }
            });
            */ 
        } 
        function DelItem(index) { 
            var tr = $("tr[id=" + index + "]"); 
            //var innerid = tr.find('input[ID$=txtInnerID]').val();  
            $("tr[id=" + index + "]").remove(); 
        } 

function chkUseNum_onclick(o) {
getObj('txtX').disabled = !o.checked;
getObj('txtY').disabled = !o.checked;
}
</script>
</head>
<body>
<!--
参考文档:
注意次API不需要key!
通过设置IMG的SRC地址访问Google地址!

-->
<div id="divStaticMap" style="font-size:14px;">
<table>
<tr>
<td style="vertical-align:top; padding-top:5px;">中心位置:</td>
<td><input id="txtCenter" type="text" value="西安,钟楼" /><br />
<input id="chkUseNum" type="checkbox" onclick="chkUseNum_onclick(this);" /><label for="chkUseNum">使用经纬度:</label><br />
<input id="txtX" type="text" value="0" disabled style="width:50px;" /> X
<input id="txtY" type="text" value="0" disabled style="width:50px;" />
<span>(纬度-180~180 经度-90~90)</span>
</td>
</tr>
<tr>
<td>缩放等级:</td>
<td><input id="txtZoom" type="text" value="11" style="width:50px;" /> <span>(0-21)</span></td>
</tr>
<tr>
<td>图像大小:</td>
<td><input id="txtWidth" type="text" value="500" style="width:50px;" /> X
<input id="txtHeight" type="text" value="500" style="width:50px;" /> <span>(640x640以内)</span></td>
</tr>
<tr>
<td>图片格式:</td>
<td><select id="selImageType" class="sel">
<option>jpg</option>
<option>png</option>
<option>png32</option>
<option>gif</option>
<option>jpg-baseline</option>
</select></td>
</tr>
<tr>
<td>地图类型:</td>
<td><select id="selMapType" class="sel">
<option value="roadmap">标准路线图</option>
<option value="satellite">卫星图片</option>
<option value="terrain">自然地形</option>
<option value="hybrid">卫星和路线图</option>
</select></td>
</tr>
<tr>
<td style="vertical-align:top; padding-top:5px;">地图标记:</td>
<td id="tdFlagList">
<table style="border:solid 1px gray;">
<tr style="font-size:12px; color:Gray; background-color:#fef;">
<td>位置(地址或经纬度以|分割)</td>
<td>标记(A-Z,0-9)</td>
<td>颜色</td>
<td>大小</td>
<td>操作</td>
</tr>
<tr>
<td><input type="text" value="西安,钟楼" /></td>
<td><input type="text" value="S" style="width:80px;" />
</td>
<td><select>
<option style="background-color:red;">red</option>
<option style="background-color:black;">black</option>
<option style="background-color:brown;">brown</option>
<option style="background-color:green;">green</option>
<option style="background-color:purple;">purple</option>
<option style="background-color:yellow;">yellow</option>
<option style="background-color:blue;">blue</option>
<option style="background-color:gray;">gray</option>
<option style="background-color:orange;">orange</option>
<option style="background-color:white;">white</option>
</select></td>
<td><select>
<option value="mid">中</option>
<option value="small">小</option>
<option value="tiny">极小</option>
</select></td>
<td>
<a style="color:Red; font-size:12px; display:none;" href="#" onclick="delMapFlag(this);">删除</a>
<a style="color:Blue; font-size:12px;" href="#" onclick="addMapFlag(this);">新增</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
<td><input type="button" value="获 取" onclick="getStaticMap();" />
</td>
</tr>
</table>
<hr />
图片地址:<input id="txtImageUrl" type="text" style="width:500px;" /><br />
<img id="imgMap" alt="" style="border:solid 2px gray; margin:10px 0px; display:none;" src="" />
</div>
<script type="text/javascript">
getStaticMap();
</script>
</body>
</html>

function SaveItem(index) {
            var tr = $("tr[id=" + index + "]");
            var innerid = tr.find('input[ID$=txtInnerID]').val();
            var item = tr.find("select[id*=selItem]").val();
            var des = tr.find('input[ID$=txtDescription]').val();
            var qty = tr.find('input[ID$=txtQTY]').val();
            var unit = tr.find('input[ID$=txtUnit]').val();
            var total = tr.find('input[ID$=txtTotal]').val();
            var remark = tr.find('input[ID$=txtRemark]').val();
            //alert(innerid + "/" + item + des + qty + unit + total + remark);
            //验证项目编号
            var proinnerid = $("#hidProjectInnerID").val();
            if (proinnerid == "") {
                $("#txtProjectNo").removeClass("Field");
                $("#txtProjectNo").addClass("Error");
                return false;
            }
            /*
            jQuery.ajax({
            type: 'get',
            url: '../Handler/ProjectReport.ashx',
            data: { "key": "save", "proinnerid": $("#hidProjectInnerID").val(), "innerid": innerid, "type": type, "content": content, "startdate": startdate, "enddate": enddate, "remark": remark },

演示代码:

            cache: false,
            success: function (result) {
            var jsonobj = eval(result);
            if (jsonobj[0].result == "true")
            alert("Sueecss");
            else
            alert("Error");
            }
            });
            */
        }
        function DelItem(index) {
            var tr = $("tr[id=" + index + "]");
            //var innerid = tr.find('input[ID$=txtInnerID]').val();
            $("tr[id=" + index + "]").remove();
        }

您可能感兴趣的文章:

  • Google 地图类型详解及示例代码
  • Google 地图控件集详解及实例代码
  • Google 地图事件实例讲解
  • Google 地图叠加层实例讲解
  • Google 地图获取API Key详细教程
  • 百度地图经纬度转换到腾讯地图/Google 对应的经纬度
  • php使用google地图应用实例
  • Google Maps API地图应用示例分享
  • 为IP查询添加GOOGLE地图功能的代码
  • google地图的路线实现代码
  • Google 地图API资料整理及详细介绍

 

] table style=width: 100%; height: 100% border=1 caption Material/Special Tool Rental/Tool Cantainer/Transportation/Mobile/caption tbodytr td Project No /td td input type=hidd...

编辑:计算机网络 本文来源:中控件值,静态地图API实现代码

关键词: