Posts

Showing posts from May, 2011

Google Maps: Clickable PolyLine using direction service

Clickable  PolyLine using direction service

=====================================================
var directionsService = new google.maps.DirectionsService();
    var request = {
        origin : point1,
        destination : point2,
        provideRouteAlternatives : false,
        travelMode : google.maps.DirectionsTravelMode.WALKING
    //travelMode: google.maps.DirectionsTravelMode.DRIVING
    };
    var polyline = new google.maps.Polyline({
                 path: [],
                 strokeColor: '#6A5ACD',
                 strokeOpacity : 0.8,
                 strokeWeight: 5
    });
    directionsService.route(request, function(result, status) {
                 if (status == google.maps.DirectionsStatus.OK) {
                       var path = result.routes[0].overview_path;
                       var legs = result.routes[0].legs;
                        for (i=0;i<legs.length;i++) {
                             var steps = legs[i].steps;
                           …

Image File content type client side validation in Java Script

Try the following code as a java script....... =================================================================
function fileUploadValidation(){ if(document.getElementById('file1').value != ''){
          var fileName  = document.getElementById('file1').value;
          var ext = fileName.substring(fileName.lastIndexOf('.') + 1);
          if(ext == "gif" || ext == "GIF" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG" || ext == "png" || ext == "PNG" ){
                 return true;              
            }else{
             alert("Upload Gif, Jpg or Png images only!");
             document.getElementById('file1').value="";
             return false;
          }
} ===============================================================