Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/03/2010, 14:27
akinilator
 
Fecha de Ingreso: marzo-2010
Mensajes: 9
Antigüedad: 14 años, 2 meses
Puntos: 0
Problema objeto Location

Hola, buenas, primero me presento ya que soy nuevo.
Mi problema es el siguiente, tengo que hacer un ejercicio en el que me piden un programa javascript que muestre todas las opciones del objeto Location.Lo tengo que hacer en una funcion y mostrarla en el body.
Este es mi ejercicio aunque me faltaria el objeto replace(url):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Hello!</title>

<script languaje="javascript">
function ejercicio(){
document.write('hash: ')
document.write(location.hash)
document.write('<br />')
document.write('host: ')
document.write(location.host)
document.write('<br />')
document.write('hostname: ')
document.write(location.hostname)
document.write('<br />')
document.write('href: ')
document.write(location.href)
document.write('<br />')
document.write('port: ')
document.write(location.port)
document.write('<br />')
document.write('protocol: ')
document.write(location.protocol)
document.write('<br />')
document.write('pathname: ')
document.write(location.pathname)
document.write('<br />')
document.write('target: ')
document.write(location.target)
document.write('<br />')

}
</script>



</head>

<body>


<input type="Button" name="boton" value="ejercicio" onClick="ejercicio();">

<input type="submit" value="Actualizar" onClick="javascript:location.reload()">

</body>

</html>

Mi intencion es meter el objeto reload() tambien en la funcion, y no tener que declararlo en el head.¿Como lo hago? y ¿Como hago para que se muestre mi funcion sin necesidad de crear un boton?

Muchisimas gracias a todos.Un cordial saludo