Ver Mensaje Individual
  #5 (permalink)  
Antiguo 30/01/2011, 04:37
miguelvivot
 
Fecha de Ingreso: enero-2011
Mensajes: 6
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: Cambiar href con Javascript

Muchas gracias por su ayuda!
Dejo el la aplicacion funcionando para futuras consultas.

<script language="javascript">
function cambiarHref(pais, region)
{
pais=pais.replace(/\s+/g,"-");
var new_pais = pais.toLowerCase();

region=region.replace(/\s+/g,"-");
var new_region = region.toLowerCase();

if(new_region == "cuba" || new_region == "mexico" || new_region == "antarctica" )
{
//document.links[newpais].href = "/region/" + new_pais + ".htm";
document.location.href = "http://contourstravel.com.au/region/" + new_pais + ".htm";
}
else
{
//document.links[newpais].href = "/region/" + new_region + "/" + new_pais + ".htm";
document.location.href = "http://contourstravel.com.au/region/" + new_region + "/" + new_pais + ".htm";
}
}
</script>

</head>

<body>

<a href="javascript:cambiarHref('The Bahamas', 'caribbean')" name="tag_pais">tag_pais</a>