Results 1 to 10 of 10

Thread: [RESOLVED] Javascript

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Resolved [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.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    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.

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Javascript

    Hee hee, I don't know how many times I have done something like that

    Gary

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    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.

  5. #5
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: [RESOLVED] Javascript

    Firefox & Firebug.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Re: [RESOLVED] Javascript

    Quote Originally Posted by gep13 View Post
    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
    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.

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Javascript

    Hey,

    Yip, it can be a life saver!!

    Gary

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Re: [RESOLVED] Javascript

    Quote Originally Posted by mendhak View Post
    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
  •  



Click Here to Expand Forum to Full Width