Monthly Archive for Agosto, 2008

JS: AGGIORNARE SOLO L’IMMAGINE, E NON LA PAGINA

 
<script><!--mce:0--></script>
 
<strong>Questo script ricarica un'immagine, e non la pagina</strong>
 
<script type="text/javascript"><!--mce:1--></script>

JS: TASTO PREMUTO

<script type="text/javascript">
function CodiceTasto(e)
{
alert("Codice del tasto premuto: " + e.keyCode + "\n");
}
</script>
 
<input onkeydown="CodiceTasto(event)" name="password" size="20" type="text" />

Di seguito è mostrato un esempio: provate a scrivere nel box sottostante…

JS: ORARIO

 
<script language="JavaScript" type="text/javascript">
 
// Prelevato e spiegato su: http://www.web-link.it
function showFilled(Value)
{
   return (Value > 9) ? "" + Value : "0" + Value;
}
 
function StartClock24()
{
   TheTime = new Date;
   document.clock.showTime.value = showFilled(TheTime.getHours()) + ":" + showFilled(TheTime.getMinutes()) + ":" +     showFilled(TheTime.getSeconds());
   setTimeout("StartClock24()",1000)
}
 
</script>
<style type="text/css">
<!--
.input
{
   border-style: none;
   font-family: Verdana,Arial,Helvetica,sans-serif;
   font-size: 10pt;
   color : red;
}
-->
</style>
 
<body onLoad="StartClock24()">
 
<div align='center'>
   <form name="clock"><input type="text" name="showTime" size="8" class="input"></form>
</div>
 
</body>

ESEMPIO

JS: AGGIORNARE LA PAGINA A TEMPO

Per aggiornare la pagina in modo automatico, basta scrivere il seguente codice tra i tag <head> come mostrato nell’esempio:

<head>
   <meta http-equiv="refresh" content="3">
</head>

content=”3″ indica 3 secondi