Can somebody point out if I am doing something really stupid here?
Here's my script:
I link it to an asp: button:Code:<head runat="server"> <title></title> <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script> <script type="text/javascript"> function MapIt { var map = null; var CurrentPos = null; var pinPoint = null; var pinPixel = null; var lat = document.getElementById("<%=txtMapLat.ClientID%>").value; var lon = document.getElementById("<%=txtMapLon.ClientID%>").value; var latlist = lat.split(","); var longlist = lon.split(","); CurrentPos = new VELatLong(latlist[0], longlist[0]); map.LoadMap(CurrentPos, 15, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1); for(var i=0; i < field1.length;i++){ CurrentPos = new VELatLong(latlist[i], longlist[i]); pinPoint = map.GetCenter(); pinPixel = map.LatLongToPixel(pinPoint); map.AddPushpin(pinPoint); } }; </script> </head>
When I run it I get an:Code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Button1.Attributes.Add("onclick", "MapIt();") End Sub
Microsoft JScript runtime error: Object expected
on MapIt(); like it has no idea what the function is.




Reply With Quote