.dsy:it.
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Tech (http://www.dsy.it/forum/forumdisplay.php?forumid=189)
-- [javascript] help (http://www.dsy.it/forum/showthread.php?threadid=16489)


Posted by CLod on 14-01-2005 10:59:

[javascript] help

ciao
avrei bisogno di fare una specie di questionario
solamente che non avendo a disposizione un webserver, mi occorre farlo senza
ho pensato a una pagina web con javascript, che in base alla scelta effettuata da un certo risultato
so poco o niente di JS
sapete darmi una mano?

potrei anche farlo con word o excel, ma pure lì sono una chiavica

__________________
Se il pugno e' chiuso la mano e' vuota. Solo se la mano e' aperta puoi possedere tutto


Posted by ripe on 14-01-2005 11:30:

Io posso darti una mano con javascript, è fattibile come cosa. Solo che devi essere un pò più preciso... :asd:

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by UZI on 14-01-2005 11:56:

beh, ci sono le textarea, le checklists, i radio buttons, i menù a scelta multipla... come deve essere strutturato il questionario?

__________________
those who test will find a bullet in they chest
put ta rest
by a brotha who was hopeless
grow up broke on tha rope of insanity
how many pistols smoking coming from a broken family


Posted by CLod on 14-01-2005 13:04:

con <select....><option value=.....>
non ricordo come si chiamano :?
ops

una volta selezionate tutte le risposte dovrebbe generarmi un testo con il risultato
una roba del genere

__________________
Se il pugno e' chiuso la mano e' vuota. Solo se la mano e' aperta puoi possedere tutto


Posted by ripe on 14-01-2005 13:43:

uhm, sei sempre troppo vago, ma proviamo lo stesso.

Intendi le ComboBox, o DropDownList, anche detti "menu di selezione a tendina"? :D

Puoi mettere una funzione che scatta all'evento onChange associato ad ognuno dei controlli. Nella funzione controlli se tutte le caselline sono state compilate e in caso affermativo generi un report da inserire in un DIV o uno SPAN tramite la proprietà InnerHtml.

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by CLod on 14-01-2005 16:15:

Originally posted by ripe
uhm, sei sempre troppo vago, ma proviamo lo stesso.

Intendi le ComboBox, o DropDownList, anche detti "menu di selezione a tendina"? :D

Puoi mettere una funzione che scatta all'evento onChange associato ad ognuno dei controlli. Nella funzione controlli se tutte le caselline sono state compilate e in caso affermativo generi un report da inserire in un DIV o uno SPAN tramite la proprietà InnerHtml.



proprio questo :D

solo che non so da che parte cominciare
se mi date qualche link o qualche riga di codice da cui prendere spunto vi sarei grato

altrimenti fa nada
tanto non è per me :D

__________________
Se il pugno e' chiuso la mano e' vuota. Solo se la mano e' aperta puoi possedere tutto


Posted by ripe on 14-01-2005 17:33:

Beh, non saprei da dove fartele prendere quelle righe, quindi te le scrivo io! :D

Il senso è questo

<select id="Domanda1" onChange="controllaDomande()">
... opzioni ...
</select>

<select id="Domanda2" onChange="controllaDomande()">
... opzioni ...
</select>

<div id="Resoconto"></div>

Lascia un'opzione di default il cui valore potrebbe essere "nothing"...

<script language="Javascript">

var numeroDomande = 2;

function controllaDomande() {
var completo = true;

for(i=1; i < numeroDomande; i++) {
var select = document.getElementById("Domanda" + i);

if(select[select.selectedIndex].value == "nothing")
completo = false
}

if(completo)
stampaResoconto();
}

function stampaResoconto() {
var testo = "";

for(i=1; i < numeroDomande; i++) {
var select = document.getElementById("Domanda" + i);

testo += "Domanda " + i + ": " + select[select.selectedIndex].value + "<br />";

var resoconto = document.getElementById("Resoconto");
resoconto.innerHtml = testo;
}
}

</script>

Questa può andare! ;)

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by UZI on 14-01-2005 18:22:

ma questo genera un resoconto realtime, vero? fico... cmq penso che al nostro amico serva anche il costrutto FORM coi vari submit e reset. non posto codice xchè sono arrugginito con la sintassi!!!

__________________
those who test will find a bullet in they chest
put ta rest
by a brotha who was hopeless
grow up broke on tha rope of insanity
how many pistols smoking coming from a broken family


Posted by ripe on 14-01-2005 18:58:

Beh, spero che il form lo sappia scrivere da solo! :asd:

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by 0m4r on 16-01-2005 12:39:

JS è una soluzione, ma poi come e dove memorizzi i risultati del test?

__________________
http://www.twitter.com/0m4r


Posted by CLod on 17-01-2005 11:26:

non devo memorizzarli
una volta ottenuto il risultato lo stampano
non serve altro
grazie mille
proverò!

__________________
Se il pugno e' chiuso la mano e' vuota. Solo se la mano e' aperta puoi possedere tutto


All times are GMT. The time now is 03:01.
Show all 11 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.