Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/03/2014, 15:56
Toninito
 
Fecha de Ingreso: abril-2010
Mensajes: 40
Antigüedad: 14 años
Puntos: 0
Respuesta: Ejecutar funcion al cargar página

Gracias por contestar andresgarciadev

Soy nuevo en esto de Javascript ya intente lo que me mencionas pero no funciona

anexo mi codigo

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
 <script type="text/javascript">
document.getElementById('semana').value=getWeekNr();
function getWeekNr(){
	var now=new Date(),i=0,f,sem=(new Date(now.getFullYear(), 0,1).getDay()>0)?1:0;
	while( (f=new Date(now.getFullYear(), 0, ++i)) < now ){
		if(!f.getDay()){
			sem++;
		}
	}
	return sem;
}
</script>
</head>

<body onload="getWeekNr();">
<input name="semana" type="text" class="tb836" id="semana" size="5" readonly="readonly" />
</body>
</html>