Visualizzazione dei risultati da 1 a 7 su 7
  1. #1
    Utente di HTML.it L'avatar di a.felix
    Registrato dal
    Sep 2001
    Messaggi
    337

    Javascript e dom, non riesco a visualizzare l'output

    Ciao,
    non riesco a visualizzare l'output su un campo label o div..span quello che sia , ma solamente con il campo input come mai?
    l'esempio che segue difatti non funziona ma se altresì metto <input name="nome" value=""..ecc e chiamo document.form1.nome.value me lo visualizza ma a me non serve un campo di input
    come posso risolvere?


    Grazie
    codice:
    <!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" lang="it">
    <head>
    <script type= 'text/javascript ' language= 'JavaScript '>
    <!--
    var timerID = null; var timerRunning = false;
    function stopclock (){
            if(timerRunning)
                    clearTimeout(timerID);
            timerRunning = false;}
    function showtime () {
            var now = new Date();
            var hours = now.getHours();
            var minutes = now.getMinutes();
            var seconds = now.getSeconds()
    		var timeValue =  ' ' + hours
            timeValue += ((minutes < 10) ?  ':0' :  ':') + minutes
            timeValue += ((seconds < 10) ?  ':0' :  ':') + seconds
            document.all.clock.innerText = timeValue;
            timerID = setTimeout( 'showtime() ',1000);
            timerRunning = true;}
    		window.onload=function startclock () {
            stopclock();
            showtime();}
    //-->
    </script>
    
    </head>
    <body>
    
    
    
    <div align="center">
    <FORM name="form1" onsubmit=0>
    <div id="clock" title=""></div>
    </FORM> 
    </div>
    </body>
    </html>

  2. #2
    Utente di HTML.it L'avatar di floyd
    Registrato dal
    Apr 2001
    Messaggi
    3,837
    prova con
    document.getElementById('clock').innerHTML = timeValue;

  3. #3
    Utente di HTML.it L'avatar di a.felix
    Registrato dal
    Sep 2001
    Messaggi
    337
    grazie floyd

    questa cosa non l'ho mai capita...come mi poso documentare su questo così non rompo più?
    ho guardato sulla guida ma non cèscritto molto a riguardo

    Grazie Ancora
    Antonio

  4. #4
    Utente di HTML.it L'avatar di floyd
    Registrato dal
    Apr 2001
    Messaggi
    3,837
    io uso questo http://www.devguru.com/technologies/xml_dom/home.asp ma sto vedendo che non ci sono parecchie cose, tipo innerHTML

  5. #5
    Utente di HTML.it L'avatar di a.felix
    Registrato dal
    Sep 2001
    Messaggi
    337
    grazie

    ho un problemino ora ho pertato il mio script in maniera dinamica nella pagina aspx (l'ho fatto registrare nel prerender) ma non funziona :master: non riesco a capire perchè, mi puoi aiutare se ti posto l'html risultante?
    codice:
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head><title>
    	Untitled Page
    </title><link href="Css/style.css" rel="stylesheet" /></head>
    <body>
        <form name="form1" method="post" action="Default.aspx" id="form1">
    <div>
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    <input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTg5MjA3MzY0MQ9kFgICAw9kFgICAQ9kFhICAQ8PFgIeBFRleHQFAzEvNGRkAgMPDxYCHwAFCjI3LzA2LzIwMDZkZAIFDw8WAh8ABQQwLjAwZGQCBw8PFgIfAAUKMjcvMDYvMjAwNmRkAgkPDxYCHwAFHDQgUmlzcG9zdGU8YnIvPjIgU2VsZXppb25hdGVkZAILDw8WAh8ABUs8cD5QYXJhZ3JhZm88L3A+PG9sPkxpc3RhPGxpPnBpcHBvMTwvbGk+PGxpPnBpcHBvMjwvbGk+PGxpPnBpcHBvMzwvbGk+PC9vbD5kZAINDxBkEBUEA2RhcwNzZGEDZGFzA3NkYRUEATEBMgEzATQUKwMEZ2doaBYCZgIBZAIPDxAPFgIeB0NoZWNrZWRnZGRkZAIRDw8WAh4HRW5hYmxlZGhkZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WBgUaRXhhbVF1ZXJ5MSRDaGVja0JveExpc3QxJDAFGkV4YW1RdWVyeTEkQ2hlY2tCb3hMaXN0MSQxBRpFeGFtUXVlcnkxJENoZWNrQm94TGlzdDEkMgUaRXhhbVF1ZXJ5MSRDaGVja0JveExpc3QxJDMFGkV4YW1RdWVyeTEkQ2hlY2tCb3hMaXN0MSQzBRlFeGFtUXVlcnkxJGNoZWNrX1JpdmVkZXJlEOONdNdo7yVaamZqO+xHf26mXqg=" />
    </div>
    
    <script type="text/javascript">
    <!--
    var theForm = document.forms['form1'];
    if (!theForm) {
        theForm = document.form1;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    // -->
    </script>
    <DIV id=container><DIV id=pageHeader></DIV>
    <DIV id=intro>
        <div id="Titolo">
            
    
    <span class="TextTitolo">Titolo Esame</span></p>
        </div>
        <div id="Sottotitolo">
            
    
    <span id="ExamQuery1_lbl_Domande">1/4</span></p>
    
        </div>
        <div id="Dettagli">
            <span id="ExamQuery1_lbl_Time">27/06/2006</span>
    
            <div id="clock" ></div>
            
    
            Orario di Inizio:
            
    
            <span id="ExamQuery1_lbl_InizioEsame" title="Orario di inizio esame">0.00</span>
    
    
            
    
            Tempo restante:
    
            <span id="ExamQuery1_lbl_Restante" title="Tempo Restante">27/06/2006</span>
    
            
    
            <span id="ExamQuery1_lbl_Risposte" title="Dettagli Risposte">4 Risposte
    2 Selezionate</span>
    
        </div>
        <div id="Quesiti">
    
            <span class="TextDomande">Domanda:</span>
            
    
            <span id="ExamQuery1_lbl_Domanda">
    
    Paragrafo</p>
    1. Lista
    2. pippo1
    3. pippo2
    4. pippo3
    </span> </div> <div id="Risposte"> <span class="TextRisposte">Risposte:</span> <table id="ExamQuery1_CheckBoxList1" border="0"> <tr> <td><input id="ExamQuery1_CheckBoxList1_0" type="checkbox" name="ExamQuery1$CheckBoxList1$0" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'ExamQuery1$CheckBoxList1$0\',\'\')', 0)" /><label for="ExamQuery1_CheckBoxList1_0">das</label></td> </tr><tr> <td><input id="ExamQuery1_CheckBoxList1_1" type="checkbox" name="ExamQuery1$CheckBoxList1$1" checked="checked" onclick="javascript:setTimeout('__doPostBack(\'ExamQuery1$CheckBoxList1$1\',\'\')', 0)" /><label for="ExamQuery1_CheckBoxList1_1">sda</label></td> </tr><tr> <td><span disabled="disabled"><input id="ExamQuery1_CheckBoxList1_2" type="checkbox" name="ExamQuery1$CheckBoxList1$2" disabled="disabled" onclick="javascript:setTimeout('__doPostBack(\'ExamQuery1$CheckBoxList1$2\',\'\')', 0)" /><label for="ExamQuery1_CheckBoxList1_2">das</label></span></td> </tr><tr> <td><span disabled="disabled"><input id="ExamQuery1_CheckBoxList1_3" type="checkbox" name="ExamQuery1$CheckBoxList1$3" disabled="disabled" onclick="javascript:setTimeout('__doPostBack(\'ExamQuery1$CheckBoxList1$3\',\'\')', 0)" /><label for="ExamQuery1_CheckBoxList1_3">sda</label></span></td> </tr> </table> </div> <div id="Footer"> <table border=0 cellpadding=0 cellspacing=0 width=100% align="left" height="20" ><tr><td style="width: 77px; height: 20px;"> <span title="Selezionando questa spunta alla fine dell'esame potrai rivedere questa domanda più agevolmente"><input id="ExamQuery1_check_Rivedere" type="checkbox" name="ExamQuery1$check_Rivedere" checked="checked" /><label for="ExamQuery1_check_Rivedere">Rivedere</label></span></td><td align="right" style="height: 20px"> <input type="submit" name="ExamQuery1$btn_Back" value="Back" id="ExamQuery1_btn_Back" disabled="disabled" title="Visualizza la domanda precedente" style="font-size:Smaller;height:20px;width:60px;" /> <input type="submit" name="ExamQuery1$btn_Next" value="Next" id="ExamQuery1_btn_Next" title="Visualizza la prossima domanda" style="font-size:Smaller;height:20px;width:60px;" /> </td></tr></table> </div> </DIV> </DIV> <div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCAKxwdrADAKI4cuzDgKI4cezDgKI4cOzDgKI4b+zDgLG58CfDwLK6M/uCQK5vtyuA8eq3gD4d2cjJfNs2EBU7B96k3lj" /> </div> <script type='text/javascript' language='JavaScript'> <!-- var timerID = null; var timerRunning = false; function stopclock (){ If (timerRunning) Then clearTimeout(timerID); timerRunning = false;} function showtime () { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var(seconds = Now.getSeconds()) /*var timeValue = '' + ((hours >12) ? hours -12 :hours)*/ var(TimeValue() = '' + hours) timeValue += ((minutes < 10) ? ':0' : ':') + minutes timeValue += ((seconds < 10) ? ':0' : ':') + seconds /*timeValue += (hours >= 12) ? ' p.m.' : ' a.m.'*/ document.getElementById('clock').innerHTML = timeValue; timerID = setTimeout('showtime()',1000); timerRunning = true;} window.onload=function startclock () { stopclock(); showtime();} //--> </script></form> </body> </html>

  6. #6
    Utente di HTML.it L'avatar di floyd
    Registrato dal
    Apr 2001
    Messaggi
    3,837
    forse questo deve essere senza il nome
    window.onload = function() {
    stopclock();
    showtime();
    }

  7. #7
    Utente di HTML.it L'avatar di a.felix
    Registrato dal
    Sep 2001
    Messaggi
    337
    :rollo: non funge mannaggia

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.