Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. [Javascript]Script

[Javascript]Script

Pianificato Fissato Bloccato Spostato Coding
1 Post 1 Autori 635 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • F
    F
    fabrizio23
    scritto su ultima modifica di
    User Attivo 5
    #1
    [Javascript]Script

    Ciao ragazzi! Ho trovato finalmente uno script su un questionario, non capisco perchè non mi vengono le immagini, i quadratini delle risposte.
    Praticamente, se io rispondo giusto la casella quadrata diventa verde, altrimenti diventa rossa, passando sempre in automatico alla domanda successiva.
    Ho provato a mettere delle immagini .gif in fondo, ok, vengono, ma la casella rossa e verde in caso di risposta giusta o errata non capisco dove devo agire...

    <html>
    <head>
    <title>Quiz sul BLS</title>
    <style type="text/css">
    #header { position: absolute; left: 32px; top: 20px; }
    #mainnav { position: absolute; left: 32px; top: 82px; }
      
    #q1 { position:absolute; top:170px;left:50px; width:495px;}
    #q2 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #q3 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #q4 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #q5 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #q6 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #q7 { position:absolute; top:170px;left:50px; width:468px; visibility:hidden;}
    #q8 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #q9 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #q10 { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #thanks { position:absolute; top:170px;left:50px; width:495px; visibility:hidden;}
    #qTracker { position:absolute;width:102px;top:169px;left:550px;font-family: Arial, Helvetica, sans-serif;font-size: 10px;height: 243px;}
    #right {font-family:Arial,sans-serif;font-weight:bold;font-size:14px;position:relative;color:green;visibility:hidden;}
    #wrong {font-family:Arial,sans-serif;font-weight:bold;position:relative;font-size:14px;color:red;visibility:hidden;}
    .riservato {font-family:Arial, sans-serif;font-size:13px;font-weight:bold;color:#000099}
    .header {font-family:Arial, sans-serif;font-size:12px;font-weight:bold;color:#333333}
    .autore {font-family:Arial,sans-serif;font-size:11px;color:#990000;}
    .questionHd {font-family:Arial,sans-serif;font-size:11px;font-weight:bold;text-decoration: underline;}
    .trackerHd {font-family:Arial,sans-serif;font-size:10px;font-weight:bold;}
    .qText {font-family:Arial,sans-serif;font-size:11px;}
    .bold {font-family:Arial,sans-serif;font-size:11px;font-weight:bold;}
    </style>
    <script language="JavaScript">
    // preload images
    for (i=0; i<10;i++)
    {
     current = new Image()
     eval("current.src= Forse devo agire qui ma non sò come...mettendo forse il percorso della cartella con tutte le immagini gif? 'images/current" + i + ".gif'")
     unanswered = new Image()
     eval("unanswered.src= 'images/unanswered" + i + ".gif'")
     right = new Image()
     eval("right.src= 'images/right" + i + ".gif'")
     wrong = new Image()
     eval("wrong.src= 'images/wrong" + i + ".gif'")
    }
    // set some global variables
    userAnswered = new Array(10)
    for (i=0;i<userAnswered.length;i++)
    {
     userAnswered[i] = false
    }
    rightAnswers = new Array("e","d","b","b","d","a","b","c","g","h")
    numQuestions = rightAnswers.length
    currentQuestion = 1
    score = 0
    answeredElement = null
    formRef = ""
    qTrackerRef = ""
    // set global browser identification variables
    browser = navigator.appName;
    browserNum = parseInt(navigator.appVersion);
    N4 = false;
    N6 = false;
    IE = false;
      
    if ((browser == "Netscape") && (browserNum < 5))
    {
     // Netscape 4.x
     layerRef = "document.layers['";
     endLayerRef = "']";
     styleRef = "";
     endFormRef = "";
     qTrackerRef = "document.layers['qTracker']."
     N4 = true;
    }
    else if ((browser == "Netscape") && (browserNum >= 5))
    {
     // Netscape 6
     layerRef = "document.getElementById('";
     styleRef = ".style";
     endLayerRef = "')";
     formRef = "document.forms['"
     endFormRef = "']"
     N6 = true;
    }
    else
    {
     // Internet Explorer
     layerRef = "document.all.";
     endLayerRef = "";
     styleRef = ".style";
     formRef = "document.forms['"
     endFormRef = "']"
     IE = true;
    }
    function checkAnswer(q)
    {
     if(checkForAnswer(q))
     { 
      // update userAnswered, since this question was answered
      userAnswered[currentQuestion-1] = true
      
      // determine actual answer
      if(N4) formRef = "document.layers['q" + q + "'].document."
      eval("questionObj = " + formRef + "q" + q + "form" + endFormRef)
      answer = questionObj.elements[answeredElement].value
      
      // see if answer was right
      if(answer == rightAnswers[currentQuestion-1])
      {
       score = score + 10
       eval(qTrackerRef + layerRef + "wrong" + endLayerRef + styleRef + ".visibility = 'hidden'")
       eval(qTrackerRef + layerRef + "right" + endLayerRef + styleRef + ".visibility = 'visible'") 
       updateQTracker('right',currentQuestion)
      }
      else
      {
       eval(qTrackerRef + layerRef + "right" + endLayerRef + styleRef + ".visibility = 'hidden'")
       eval(qTrackerRef + layerRef + "wrong" + endLayerRef + styleRef + ".visibility = 'visible'")
       updateQTracker('wrong',currentQuestion)
      }
      
      // see if test is finished
      numAnswered=0
      for (i=0;i<userAnswered.length;i++)
      {
       if (userAnswered[i]) numAnswered = numAnswered + 1
      }
      
      if (numAnswered == rightAnswers.length)
      {
       quizFinished()
      }
      else
      {
       // move on to next question
       findNextUnansweredQuestion(currentQuestion)
       oldQuestion = currentQuestion
       currentQuestion = nextUnansweredQ
       nextQuestion(oldQuestion,currentQuestion)
      }
     }
     else
     {
      // an answer wasn't chosen
      alert("Prego, scegliere un'opzione.")
     }
    }
    function checkForAnswer(q)
    {
     // Determine which radio button is selected
     // Buttons are elements, so we don't want to 
     // count the answer or skip buttons 
     // as a radio elements
     if(N4) formRef = "document.layers['q" + q + "'].document."
     eval("questionObj = " + formRef + "q" + q + "form" + endFormRef)
     numRadioOptions = questionObj.elements.length - 2
     
     // loop through all radio buttons for this question and
     // see if any of them are checked
     for(i=0; i<numRadioOptions;i++)
     {
      if(questionObj.elements[i].checked) 
      {
       answeredElement = i
       return true
      }
     }
     return false
    }
    function nextQuestion(oldQ,newQ)
    { 
     // hide old question
     eval(layerRef + "q" + oldQ + endLayerRef + styleRef + ".visibility = 'hidden'")
     // show new question
     eval(layerRef + "q" + newQ + endLayerRef + styleRef + ".visibility = 'visible'")
     
     // update question tracker
     updateQTracker('current',newQ)
    }
    function updateQTracker(state,q)
    {
     eval(qTrackerRef + "document.images['t" + q + "'].src = 'images/" + state + q + ".gif'")
    }
    function findNextUnansweredQuestion(q)
    {
     nextUnansweredQ = q
     
     // start looking forward
     for(i=q+1;i<=rightAnswers.length;i++)
     {
      if (!userAnswered[i-1])
      {
       nextUnansweredQ = i
       break
      }
     }
     
     // if necessary, start at beginning
     if (nextUnansweredQ == q)
     {
      for (i=1;i<=q;i++)
      {
       if (!userAnswered[i-1])
       {
        nextUnansweredQ = i
        break
       }
      }
     }
     return nextUnansweredQ
    }
    function skipQuestion()
    {
     findNextUnansweredQuestion(currentQuestion)
     
     oldQuestion = currentQuestion
     currentQuestion = nextUnansweredQ
      
     if (oldQuestion != nextUnansweredQ)
     {
      nextQuestion(oldQuestion,currentQuestion)
      updateQTracker('unanswered',oldQuestion)
     }
     else
     {
      // this is their last question
      ms = "Non ci sono altre domande.\n"
      ms = ms + "Hai risposto a tutte le domande.\n"
      ms = ms + "Devi rispondere a questa."
      alert(ms)
     } 
    }
    function qTrackNav(q)
    {
     // find out if this question has already been answered
     if(!userAnswered[q-1])
     {
      updateQTracker('unanswered',currentQuestion)
      nextQuestion(currentQuestion,q)
      currentQuestion = q
     }
    }
    function quizFinished()
    {
     // hide old question & show "thank you" layer
     eval(layerRef + "q" + currentQuestion + endLayerRef + styleRef + ".visibility = 'hidden'")
     eval(layerRef + "thanks" + endLayerRef + styleRef + ".visibility = 'visible'")
     
     // display score
     if (N4) formObj = document.layers['thanks'].document.forms['thanksForm']
     else formObj = document.forms['thanksForm']
     formObj.endScore.value = score
    }
    </script>
    <body bgcolor="#FFFFFF">
    <div id="mainnav">
    <span class="header">Grazie per la partecipazione, seleziona la domanda che ritieni corretta</span></div>
    <div id="q1">
    <span class="questionHd">Domanda 1</span>
    <p>
    <span class="qText"> Per un soccorritore è importante conoscere il BLS perché?</span>
    <form name="q1form">
    <span class="bold">
    <input type="radio" name="q1answer" value="a">La maggior parte dei pazienti trasportati in ambulanza necessita di RCP<br>
    <input type="radio" name="q1answer" value="b">La maggior parte delle vittime di IMA vanno in arresto prima di giungere in ospedale<br>
    <input type="radio" name="q1answer" value="c">Si può diventare istruttori BLS.<br>
    <input type="radio" name="q1answer" value="e">La maggior parte degli ACC avvengono fuori dell?ospedale<br>
    </span>
    <br>
    <input type="button" onClick="checkAnswer(1)" value="Invia Risposta" style="font:Arial, Helvetica, sans-serif; font-size:11px;">
    <input type="button" onClick="skipQuestion(1)" value="Salta Domanda"style="font:Arial, Helvetica, sans-serif; font-size:11px;" >
    </form>
    </div>
    <div id="q2">
    <span class="questionHd">Domanda 2</span>
    <p>
    <span class="qText">Il soccorritore sanitario deve verificare l?eventuale ricomparsa del polso:</span>
    <form name="q2form">
    <span class="bold">
    <input type="radio" name="q2answer" value="a">dopo 10 minuti di RCP<br>
    <input type="radio" name="q2answer" value="b">dopo 1 minuto di RCP<br>
    <input type="radio" name="q2answer" value="c">dopo 30 secondi di RCP<br>
    <input type="radio" name="q2answer" value="d">solo in presenza di segni vitali
    </span>
    <p>
    <input type="button" onClick="checkAnswer(2)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(2)" value="Salta Domanda">
    </form>
    </div>
    <div id="q3">
    <span class="questionHd">Domanda 3</span>
    <p>
    <span class="qText">La valutazione del respiro e del polso, da parte dei sanitari, deve durare?</span>
    <form name="q3form">
    <span class="bold">
    <input type="radio" name="q3answer" value="a">5 sec.<br>
    <input type="radio" name="q3answer" value="b">10 sec.<br>
    <input type="radio" name="q3answer" value="c">30 sec.<br>
    <input type="radio" name="q3answer" value="d">45 sec.
    </span>
    <p>
    <input type="button" onClick="checkAnswer(3)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(3)" value="Salta Domanda">
    </form>
    </div>
    <div id="q4">
    <span class="questionHd">Domanda 4</span>
    <p>
    <span class="qText">Le compressioni toraciche dovrebbero essere?</span>
    <form name="q4form">
    <span class="bold">
    <input type="radio" name="q4answer" value="a">25% compressione, 75% rilasciamento<br>
    <input type="radio" name="q4answer" value="b">50% compressione, 50% rilasciamento<br>
    <input type="radio" name="q4answer" value="c">75% compressione, 25% rilasciamento<br>
    <input type="radio" name="q4answer" value="d">varia con le dimensioni della vittima
    </span>
    <p>
    <input type="button" onClick="checkAnswer(4)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(4)" value="Salta Domanda">
    </form>
    </div>
    <div id="q5">
    <span class="questionHd">Domanda 5</span>
    <p>
    <span class="qText">Il BLS comprende:?</span>
    <form name="q5form">
    <span class="bold">
    <input type="radio" name="q5answer" value="a">il pronto riconoscimento dell?assenza di coscienza, respiro, polso<br>
    <input type="radio" name="q5answer" value="b">l?attivazione precoce del sistema di soccorso<br>
    <input type="radio" name="q5answer" value="c">l?esecuzione della RCP in caso di arresto cardiaco<br>
    <input type="radio" name="q5answer" value="d">tutti i precedenti
    </span>
    <p>
    <input type="button" onClick="checkAnswer(5)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(5)" value="Salta Domanda">
    </form>
    </div>
    <div id="q6">
    <span class="questionHd">Domanda 6</span>
    <p>
    <span class="qText">Il rapporto compressioni/ventilazioni con un solo soccorritore è:</span>
    <form name="q6form">
    <span class="bold">
    <input type="radio" name="q6answer" value="a">30:2<br>
    <input type="radio" name="q6answer" value="b">15:1<br>
    <input type="radio" name="q6answer" value="c">5:1<br>
    <input type="radio" name="q6answer" value="d">15:2
    </span>
    <p>
    <input type="button" onClick="checkAnswer(6)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(6)" value="Salta Domanda">
    </form>
    </div>
    <div id="q7">
    <span class="questionHd">Domanda 7</span>
    <p>
    <span class="qText">Che cos'e&eacute;Il ?gasping? o respiro agonico?</span>
    <form name="q7form">
    <span class="bold">
    <input type="radio" name="q7answer" value="a">è un tipo di respirazione poco efficace<br>
    <input type="radio" name="q7answer" value="b">é un tipo di respiro che indica al soccorritore laico la necessita' di iniziare le compressioni toraciche<br>
    <input type="radio" name="q7answer" value="c">è un tipo di distress che indica la necessità di ossigenoterapia<br>
    <input type="radio" name="q7answer" value="d">si verifica in caso di overdose da stupefacenti
    </span>
    <p>
    <input type="button" onClick="checkAnswer(7)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(7)" value="Salta Domanda">
    </form>
    </div>
    <div id="q8">
    <span class="questionHd">Domanda 8</span>
    <p>
    <span class="qText">Il numero di compressioni toraciche in un minuto deve essere:?</span>
    <form name="q8form">
    <span class="bold">
    <input type="radio" name="q8answer" value="a">60<br>
    <input type="radio" name="q8answer" value="b">80<br>
    <input type="radio" name="q8answer" value="c">100<br>
    <input type="radio" name="q8answer" value="d">110
    </span>
    <p>
    <input type="button" onClick="checkAnswer(8)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(8)" value="Salta Domanda">
    </form>
    </div>
    <div id="q9">
    <span class="questionHd">Domanda 9</span>
    <p>
    <span class="qText">Se noti distensione gastrica durante RCP, cosa fai?</span>
    <form name="q9form">
    <span class="bold">
    <input type="radio" name="q9answer" value="e">eserciti una modesta pressione con una sola mano sull?addome<br>
    <input type="radio" name="q9answer" value="f">interrompi la RCP<br>
    <input type="radio" name="q9answer" value="g">riposizioni la testa e ventili più lentamente e con meno forza<br>
    <input type="radio" name="q9answer" value="h">metti la testa del paziente in posizione neutra
    </span>
    <p>
    <input type="button" onClick="checkAnswer(9)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(9)" value="Salta Domanda">
    </form>
    </div>
    <div id="q10">
    <span class="questionHd">Domanda 10</span>
    <p>
    <span class="qText">In quale caso, durante RCP si usa ossigeno supplementare.?</span>
    <form name="q10form">
    <span class="bold">
    <input type="radio" name="q10answer" value="e">quando il soccorritore è stanco di effettuare il bocca ? bocca<br>
    <input type="radio" name="q10answer" value="f">se l?arresto è dovuto ad annegamento<br>
    <input type="radio" name="q10answer" value="g">se non c?è storia di bronchite cronica<br>
    <input type="radio" name="q10answer" value="h">appena è disponibile
    </span>
    <p>
    <input type="button" onClick="checkAnswer(10)" value="Invia Risposta">
    <input type="button" onClick="skipQuestion(10)" value="Salta Domanda">
    </form>
    </div>
    <div id="thanks">
    <span class="questionHd">Grazie per aver partecipato!</span>
    <p>
    <span class="qText">Speriamo che possa essere stato utile per te.</span>
    <br><br>
    <form name="thanksForm">
    <span class="qText">Hai totalizzato il punteggio di <input type="text" name="endScore" size=2></span>
    </form>
    </div>
    <div id="qTracker">
    <span class="trackerHd"> Riepilogo <br>
    Domande </span> 
     <table cellpadding="0" cellspacing="0">
      <tr>
       <td><a href="javascript:qTrackNav(1)"><img src="ht" Forse devo agire qui mettendo "ht:/e l'immagine gif"? alt="1" name="t1" width="31" height="31" border="0"></a></td>
       <td><a href="javascript:qTrackNav(2)"><img src="ht" alt="2" name="t2" width="31" height="31" border="0"></a></td>
      </tr>
      <tr>
       <td><a href="javascript:qTrackNav(3)"><img src="ht" alt="3" name="t3" width="31" height="31" border="0"></a></td>
       <td><a href="javascript:qTrackNav(4)"><img src="ht" alt="4" name="t4" width="31" height="31" border="0"></a></td>
      </tr>
      <tr>
       <td><a href="javascript:qTrackNav(5)"><img src="ht" alt="5" name="t5" width="31" height="31" border="0"></a></td>
       <td><a href="javascript:qTrackNav(6)"><img src="ht" alt="6" name="t6" width="31" height="31" border="0"></a></td>
      </tr>
      <tr>
        <td><a href="javascript:qTrackNav(7)"><img src="" alt="7" name="t7" width="31" height="31" border="0"></a></td>
        <td><a href="javascript:qTrackNav(8)"><img src="htt" alt="8" name="t8" width="31" height="31" border="0"></a></td>
       </tr>
      <tr>
        <td><a href="javascript:qTrackNav(9)"><img src="ht" alt="9" name="t9" width="31" height="31" border="0"></a></td>
        <td><a href="javascript:qTrackNav(10)"><img src="ht" alt="10" name="t10" width="31" height="31" border="0"></a></td>
       </tr>
      </table>
     <div id="right">&nbsp;ESATTO!</div> 
     <div id="wrong">&nbsp;ERRATO!</div>
     
    </div>
    </body>
    </html>
    
    1 Risposta Ultima Risposta
    Miglior risposta 0
    0

    Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

    Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

    Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

    Registrati Accedi
    Rispondi
    • Risposta alla discussione
    Effettua l'accesso per rispondere
    • Da Vecchi a Nuovi
    • Da Nuovi a Vecchi
    • Più Voti


    • Accedi

    • Non hai un account? Registrati

    • Accedi o registrati per effettuare la ricerca.
    • Primo post
      Ultimo post
    Home Accedi Registrati
    Menu
    • CATEGORIES
    • La Community Connect.gt
    • Presentati alla Community
    • News Ufficiali da Connect.gt
    • Internet News
    • A Scuola Di
    • Digital Marketing
    • Intelligenza Artificiale
    • SEO & GEO
    • Web Marketing e Content
    • Google Analytics e Web Analytics
    • Google Ads & Advertising
    • YouTube
    • TikTok, Instagram e altri Social
    • Google Adsense, Affiliazioni e Guadagno
    • E-Commerce
    • Coding e Sistemistica
    • Help Center: consigli per il tuo progetto
    • Hosting e Cloud
    • Coding
    • CMS & Piattaforme Self-Hosted
    • Annunci e Collaborazioni
    • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
    • Collaborazioni WEB e Lavoro: offro e cerco
    • Impresa, Fisco e Leggi
    • Consulenza Legale e Professioni Web
    • Consulenza Fiscale, Imprese, Startup e P.Iva
    • Gli Off Topic
    • PC, Smartphone e altri Hardware
    • Tutti i Software
    • GT Fetish Cafè
    • Discussioni
    • Non letti 0
    • Recenti
    • Hashtag
    • Popolare
    • Utenti
    • Privacy
    • Termini e condizioni
    • © 2026 Search On Media Group S.r.l.