hi shaneb
here is my code of html:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false"></script>
<script type="text/javascript" src="http://www.google.com/jsapi?
key=ABQIAAAA-
ggC_m54TQUROS_g74AQpBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSPDVkcrAk2rhm2lorYj-
EhWqpAAQ"></script>
<p id="demo">This is a paragraph.</p>
<!-- <p id="demo2">This is a paragraph.</p> -->
</head>
<body onload="test()">
<form name="gform" >
Freq:<select name="freq" onChange="readcells3()">
<option>10762
<option>10787
<option>10812
</select>
</form>
<script type="text/javascript">
function test()
{
alert(document.gform.freq.value);
newGMap();
readcells3();
//init();
}
//document.getElementById("demo2").innerHTML=Date()+": I m demo2";
</script>
<script type="text/javascript" src="../JS/demo.js">
</script>
<script type="text/javascript" src="../JS/CreateControl.js">
</script>
<!--<script type="text/javascript" src="../JS/EarthMap.js">
</script> -->
<script type="text/javascript" src="../JS/Sector.js">
</script>
<script type="text/javascript" src="../JS/googleEarth.js">
</script>
<script type="text/javascript" src="../JS/gCellsAdd.js">
</script>
<div id="map_canvas" style="width:100%; height:95%"></div>
</body>
</html>
here is javascript:
var map;
var googleEarth;
var strSite,strCell;
//alert(document.gform.freq.value);
// The five markers show a secret message when clicked
// but that message is not within the marker's instance data
function newGMap()
{
// Google Map
//google.load('earth', '1');
var myLatlng = new google.maps.LatLng(25.0479,121.55);
var myOptions = {
zoom: 16,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
//document.getElementById("demo").innerHTML=Date();
//map=null;
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
//googleEarth = new GoogleEarth(map);
demo();
}
function readcells3()
{
// create control as Home
initialize();
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","../xml/sitedatabase.php.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
var x=xmlDoc.getElementsByTagName("bts");
// get row data
for (i=0;i<x.length;i++)
{
var site= x[i].getElementsByTagName("site")
[0].childNodes[0].nodeValue;
var siteName= x[i].getElementsByTagName("siteName")
[0].childNodes[0].nodeValue;
var lat= x[i].getElementsByTagName("lattitude")
[0].childNodes[0].nodeValue;
var lon= x[i].getElementsByTagName("longitude")
[0].childNodes[0].nodeValue;
var cell=x[i].getElementsByTagName("cell")
[0].childNodes[0].nodeValue;
var rnc= x[i].getElementsByTagName("RNC")
[0].childNodes[0].nodeValue;
var azimuth=x[i].getElementsByTagName("direction")
[0].childNodes[0].nodeValue;
var freq= x[i].getElementsByTagName("ARFCN1")
[0].childNodes[0].nodeValue;
if(freq==document.gform.freq.value)
{
var location = new google.maps.LatLng(lat,lon);
var marker = new google.maps.Marker({
position: location,
map: map
});
strSite=site+",\n"+rnc+"\n"+siteName;
var j = i + 1;
marker.setTitle(strSite);
addClickListener(marker, i);
// Create Polygon
//Delta_y = (Length * Sin ( Angle * DEG_2_RAD ))/109
//getSector(azimuth, lat, long);
// var wi=40;
// var dist=0.001;
// var angle=parseFloat(azimuth)+wi/2;
// var deg=(Math.PI/2)-(angle*Math.PI/180);
// var deltaY=(dist*Math.sin(deg));
// var deltaX=(dist*Math.cos(deg));
// //document.write("deltaX:"+deltaX+"<br />");
// //document.write("Lon:"+lon+"<br />");
// y1=parseFloat(lat)+deltaY;
// x1=parseFloat(lon)+deltaX;
// //document.write("x1:"+x1+"<br />");
// angle=parseFloat(azimuth)-wi/2;
// //document.write("angle: "+angle+"<br/>");
// deg=(Math.PI/2)-(angle*Math.PI/180);
// var deltaY=(dist*Math.sin(deg));
// var deltaX=(dist*Math.cos(deg));
// y2=parseFloat(lat)+deltaY;
// x2=parseFloat(lon)+deltaX;
// var triangleCoords = [
// new google.maps.LatLng(lat, lon),
// new google.maps.LatLng(y1, x1),
// new google.maps.LatLng(y2, x2)
// ];
strCell=cell+"<br/>"+rnc+"<br/>"+azimuth;
// bermudaTriangle = new google.maps.Polygon({
// paths: triangleCoords,
// strokeColor: "#00CC00",
// strokeOpacity: 0.8,
// strokeWeight: 2,
// fillColor: "#00CC00",
// fillOpacity: 0.35,
// //map:map,
// title: strCell
// });
if(freq==10762)
{
bermudaTriangle=getSector(azimuth, lat,lon,strCell);
}
else if (freq==10787)
{
bermudaTriangle=getSectorF2(azimuth, lat,lon,strCell);
}
else if(freq==10812)
{
bermudaTriangle=getSectorF3(azimuth, lat,lon,strCell);
}
bermudaTriangle.setMap(map);
addCellkListener(bermudaTriangle,j);
//for(z=0;z<x[0].childNodes.length;z++)
//for(z=0;z<3;z++)
//{
//var colName= x[0].childNodes[z].nodeName;
//document.write(x[i].getElementsByTagName(colName)
[0].childNodes[0].nodeValue);
//}
}
}
}
function addClickListener(marker, number)
{
var infowindow = new google.maps.InfoWindow(
{ content: marker.title,
size: new google.maps.Size(10,10)
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
function addCellkListener(bermudaTriangle, number)
{
var infowindow = new google.maps.InfoWindow(
{ content: bermudaTriangle.title,
size: new google.maps.Size(10,10)
});
google.maps.event.addListener(bermudaTriangle, 'click',
function(event) {
//infowindow.open(map,bermudaTriangle);
//document.write(bermudaTriangle.title);
infowindow.setContent(bermudaTriangle.title);
infowindow.setPosition(event.latLng);
infowindow.open(map);
});
}
On 1月9日, 上午12時11分, sb <[email protected]> wrote:
> One suggestion is to host your code, it makes it easier to
> troubleshoot.
>
> On Jan 8, 10:20 am, Yang Chiliy <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi Rossko
>
> > Thanks for your reply !
>
> > I have tried this sample , but fail . i have attached my source code of
> >html& js , do u have any suggestion ?
>
> > BR
> > Chilly
>
> > 2012/1/8 Rossko <[email protected]>
>
> > > > i m new google map api guy, can i create map and earth in thesame
> > > >html? do u have sampe ?
>
> > >http://google-maps-utility-library-v3.googlecode.com/svn/trunk/google...
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google Maps JavaScript API v3" group.
> > > To post to this group, send email to
> > > [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
> > --
> > BR
> > Chilly
>
> > gCellsAdd.HTML
> > 6KViewDownload
>
> > gCellsAdd.js
> > 6KViewDownload
>
> > CreateControl.js
> > 2KViewDownload
>
> > gCellsAdd.HTML
> > 6KViewDownload
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.