<!DOCTYPE html>
<html>
<body>
<p id="demo">点击这个按钮,获得您的坐标:</p>
<button onclick="getLocation()">试一下</button>
<script>
var x=documentgetElementById("demo");
function getLocation()
{
if (navigatorgeolocation)
{
navigatorgeolocationgetCurrentPosition(showPosition);
}
else{xinnerHTML="Geolocation is not supported by this browser";}
}
function showPosition(position)
{
xinnerHTML="Latitude: " + positioncoordslatitude +
"<br />Longitude: " + positioncoordslongitude;
}
</script>
</body>
</html>
1、检测是否支持地理定位
2、如果支持,则运行 getCurrentPosition() 方法。如果不支持,则向用户显示一段消息。
3、如果getCurrentPosition()运行成功,则向参数showPosition中规定的函数返回一个coordinates对象
4、showPosition() 函数获得并显示经度和纬度
<body>
<div>
<canvas id="canvas" style="width: 100; height: 100;"></canvas>
<button onclick="transform();">draw</button>
</div>
<script type="text/javascript">
var canvas=documentgetElementById("canvas");
function transform(){
var context = canvasgetContext("2d");
contextbeginPath();
contextmoveTo(100, 150);
contextlineTo(450, 50);
contextlineWidth = 10;
contextstrokeStyle ="#ff0000";
contextstroke();
alert(contexttoDataURL());
}
</script>
</body>
js 调用winAPI html5 没这功能
具体能容自己修改
<html xmlns="<meta charset="UTF-8">
<head>
<title>Untitled Page</title>
</head>
<script language="javascript" type="text/javascript">
function importXLS(fileName)
{
objCon = new ActiveXObject("ADODBConnection");
objConProvider = "MicrosoftJetOLEDB40";
objConConnectionString = "Data Source=" + fileName + ";Extended Properties=Excel 80;";
objConCursorLocation = 1;
objConOpen;
var strQuery;
//Get the SheetName
var strSheetName = "Sheet1$";
var rsTemp = new ActiveXObject("ADODBRecordset");
rsTemp = objConOpenSchema(20);
if(!rsTempEOF)
strSheetName = rsTempFields("Table_Name")Value;
rsTemp = null;
rsExcel = new ActiveXObject("ADODBRecordset");
strQuery = "SELECT FROM [" + strSheetName + "]";
rsExcelActiveConnection = objCon;
rsExcelOpen(strQuery);
while(!rsExcelEOF)
{
for(i = 0;i<rsExcelFieldsCount;++i)
{
alert(rsExcelFields(i)value);
// 在这里为你的表格设计样式
}
rsExcelMoveNext;
}
// Close the connection and dispose the file
objConClose;
objCon =null;
rsExcel = null;
}
</script>
</head>
<body>
<input type="file" id="f" />
<input type="button" id="b" value="import" onclick="if(fvalue=='')alert('请选择xls文件');else importXLS(fvalue)" />
</body>
</html>
在IE中使用
以上就是关于html5获取的经纬度怎么用php上传数据库全部的内容,包括:html5获取的经纬度怎么用php上传数据库、HTML5的canvas js内部怎么获取不到toDataURL数据、在HTML5中如何读取Excel中的数据并且在火狐浏览器中显示啊等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)