Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Data e ora

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    71

    Data e ora

    Ho un problema con una javascript su mozilla:

    <span id=\"liveclock\">
    </span><script language=\"JavaScript\">
    <!--

    function show5(){
    if (!document.layers&&!document.all)
    return
    var Digital=new Date()
    var hours=Digital.getHours()
    var minutes=Digital.getMinutes()
    var seconds=Digital.getSeconds()
    var date=Digital.getDate()
    var month=Digital.getMonth() + 1
    var years=Digital.getYear()

    if (hours==0)
    hours=12
    if (minutes<=9)
    minutes=\"0\"+minutes
    if (seconds<=9)
    seconds=\"0\"+seconds
    if (date<=9)
    date=\"0\"+date

    if (month==1){
    month=\"Gennaio\"
    }else if (month==2){
    month=\"Febbraio\"
    }else if (month==3){
    month=\"Marzo\"
    }else if (month==4){
    month=\"Aprile\"
    }else if (month==5){
    month=\"Maggio\"
    }else if (month==6){
    month=\"Giugno\"
    }else if (month==7){
    month=\"Luglio\"
    }else if (month==8){
    month=\"Agosto\"
    }else if (month==9){
    month=\"Settembre\"
    }else if (month==10){
    month=\"Ottobre\"
    }else if (month==11){
    month=\"Novembre\"
    }else if (month==12){
    month=\"Dicembre\"
    }
    //change font size here to your desire
    myclock=\"<font class='white'>\"+date+\"\"+month+\"\"+years+\"\"+h ours+\":\"+minutes+\":\"+seconds+\"</font>\"
    if (document.layers){
    document.layers.liveclock.document.write(myclock)
    document.layers.liveclock.document.close()
    }
    else if (document.all)
    liveclock.innerHTML=myclock
    setTimeout(\"show5()\",1000)
    }
    //-->
    </script>

    non appare nulla, premetto che le virgolette sono precedute da "\" perchè è inserito all'interno di un file PHP

  2. #2
    Utente di HTML.it L'avatar di hcka
    Registrato dal
    Oct 2002
    Messaggi
    435
    Prova ad aggiungere all'if di "scrittura" (

    codice:
    if (document.layers){
    document.layers.liveclock.document.write(myclock)
    document.layers.liveclock.document.close()
    }
    else if (document.all)
    liveclock.innerHTML=myclock
    ) questo codice:

    codice:
    else if (document.getElementById)
    {
      if (document.getElementById("liveckock").firstChild)
        document.getElementById("liveckock").removeChild(document.getElementById("liveckock").firstChild);
      documen.getElementById("liveckock").appendChild(document.createTextNode(myclock));
    }
    In modo che diventi:

    codice:
    if (document.layers)
    {
      document.layers.liveclock.document.write(myclock)
      document.layers.liveclock.document.close()
    }
    else if (document.all)
      liveclock.innerHTML=myclock
    else if (document.getElementById)
    {
      if (document.getElementById("liveckock").firstChild)
        document.getElementById("liveckock").removeChild(document.getElementById("liveckock").firstChild);
      documen.getElementById("liveckock").appendChild(document.createTextNode(myclock));
    }
    Prova e facci sapere...

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    71
    non va

  4. #4
    Utente di HTML.it L'avatar di hcka
    Registrato dal
    Oct 2002
    Messaggi
    435

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.