|
-
Mar 10th, 2010, 10:27 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Javascript
Can somebody point out if I am doing something really stupid here?
Here's my script:
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>
I link it to an asp: button:
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Button1.Attributes.Add("onclick", "MapIt();")
End Sub
When I run it I get an:
Microsoft JScript runtime error: Object expected
on MapIt(); like it has no idea what the function is.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Mar 10th, 2010, 10:31 AM
#2
Thread Starter
Frenzied Member
Re: Javascript
Lol nevermind, forgot the () after the function name.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Mar 11th, 2010, 03:17 AM
#3
Re: [RESOLVED] Javascript
Hee hee, I don't know how many times I have done something like that 
Gary
-
Mar 11th, 2010, 09:22 AM
#4
Thread Starter
Frenzied Member
Re: [RESOLVED] Javascript
Do you guys use anything to debug your javascript?
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Mar 11th, 2010, 01:11 PM
#5
Re: [RESOLVED] Javascript
-
Mar 11th, 2010, 02:00 PM
#6
Re: [RESOLVED] Javascript
Hey,
Which version of Visual Studio are you using? Visual Studio 2008 allows you to set BreakPoints in your JavaScript:
http://weblogs.asp.net/scottgu/archi...debugging.aspx
Gary
-
Mar 11th, 2010, 02:09 PM
#7
Thread Starter
Frenzied Member
Re: [RESOLVED] Javascript
 Originally Posted by gep13
Lol yeah I just figured out this morning on accident that I could do that. That helps a lot.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Mar 11th, 2010, 02:12 PM
#8
Re: [RESOLVED] Javascript
Hey,
Yip, it can be a life saver!!
Gary
-
Mar 13th, 2010, 03:41 AM
#9
Re: [RESOLVED] Javascript
If you're using VE 6.2, some of your code is deprecated now. Have a look here for changes between versions:
http://msdn.microsoft.com/en-us/library/cc161073.aspx
Pushpins are now added like so:
Code:
var pin = new VEShape(VEShapeType.Pushpin, latlong);
pin.SetCustomIcon(icon_url);
pin.SetTitle(title);
pin.SetDescription(details);
map.AddShape(pin);
The reason this is relevant is because they control the JS, they can actually remove the method support completely at any point. I'm sticking with V6 though.
-
Mar 15th, 2010, 12:21 PM
#10
Thread Starter
Frenzied Member
Re: [RESOLVED] Javascript
 Originally Posted by mendhak
If you're using VE 6.2, some of your code is deprecated now. Have a look here for changes between versions:
http://msdn.microsoft.com/en-us/library/cc161073.aspx
Pushpins are now added like so:
Code:
var pin = new VEShape(VEShapeType.Pushpin, latlong);
pin.SetCustomIcon(icon_url);
pin.SetTitle(title);
pin.SetDescription(details);
map.AddShape(pin);
The reason this is relevant is because they control the JS, they can actually remove the method support completely at any point. I'm sticking with V6 though.
Yeah I already made the change to using shapes, but thanks.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|