Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/04/2009, 14:24
eurodoblon
 
Fecha de Ingreso: enero-2008
Mensajes: 303
Antigüedad: 16 años, 3 meses
Puntos: 0
variables entre funciones

Buenas noches:
Tenggo estas dos funciones, y no se como pasar la variable de una a otra.
La variable la saco de la primera funcion: var coordenadas =(ajax.responseText);

y quiero llevar a la segunda en var center = new GLatLng(coordenadas );



Gracias y un saludo
Código HTML:
function check_Disponible(value)
{ var valor=document.formulario.direccion.value;
var valor1=document.formulario.localidad.value;
var valor2=document.formulario.restaurante.value;
    ajax=nuevoAjax();
    ajax.open("GET", "coordenadas_ayax.php?direccion="+valor+"&localidad="+valor1+"&provincia="+valor2+"&nocahe="+Math.random(), true);
    ajax.onreadystatechange=function() 
    { 
        if (ajax.readyState==4)
        { 
            document.getElementById("map_canvas").innerHTML=ajax.responseText;
		var coordenadas =(ajax.responseText);	
			
					
        } 
    }
    ajax.send(null);  
	     
}

function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas1"));
		map.addControl(new GSmallMapControl());

        var center = new GLatLng(coordenadas ); 
     map.setCenter(center, 15);
point=map.getCenter();
        var marker = new GMarker(center, {draggable: true,bouncy :false});
 
        GEvent.addListener(marker, "dragstart", function() {
          map.closeInfoWindow();
        });
 
        GEvent.addListener(marker, "dragend", function() {
               });