Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Forum De Bell Tolls > [JAVASCRIPT] Operazioni nei Form.
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
[JAVASCRIPT] Operazioni nei Form.

<tr>
<td><input type="radio" name="hotel" value="marina" onSelect=""></td>
<td>Hotel 1 </td>
<td>460 € </td>

</tr>
<tr>
<td><input type="radio" name="hotel" value="western"></td>
<td>Hotel 2 </td>
<td>432 € </td>
</tr>
<tr>
<td><div align="right">
<input type="checkbox" name="aggiungici">
</div></td>
<td>120 € </td>
</tr>

<tr>
<td><div align="right"><strong>Importo Totale </strong></div></td>
<td><input type="text" name="tot"></td>
</tr>


Voglio che nella casella Importo Totale venga indicato il valore corrispondente alle caselle selezionate, ovvero:
460, 432, 580 o 552

E' possibile?!?!

21-01-2004 14:50
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
korn
SET FIRE!

User info:
Registered: Jun 2002
Posts: 5793 (0.69 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Prova così...


code:
<script language="JavaScript"> <!-- function totale () { var palbergo = 0; if ( document.forms[0].hotel.value == "marina" ) palbergo = 460; if ( document.forms[0].hotel.value == "western" ) palbergo = 432; if ( document.forms[0].aggiungici.checked == true ) palbergo += 120; document.forms[0].tot.value = palbergo; } //--> </script>


e poi aggiungi negli <input> del check e dei radio
code:
onClick="totale();"


E' fatto in fretta e furia, spero funzioni :)

Se non funziona, prova a sostituire forms[0] con il nome della form, e ricorda che JS è case-sensitive!

__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.

21-01-2004 15:17
Click Here to See the Profile for korn Click Here to See the Blog of korn Click here to Send korn a Private Message Visit korn's homepage! Find more posts by korn Add korn to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Posso fare:

if ( document.forms[0].aggiungici.checked == true && document.forms[0].hotel.value == "western" )

??

Cosa devo mettere nel value di Importo Totale?

Last edited by dan on 21-01-2004 at 16:16

21-01-2004 16:13
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

OK funzia alla perfection! :D

Il codice giusto era:
code:--------------------------------------------------------------------------------
<script language="JavaScript">
<!--
function totale () {
var palbergo = 0;
if ( document.forms[0].hotel[0].checked == true )
palbergo = 460;
if ( document.forms[0].hotel[1].checked == true )
palbergo = 432;
if ( document.forms[0].aggiungici.checked == true )
palbergo += 120;
document.forms[0].tot.value = palbergo;
}
//-->
</script>
--------------------------------------------------------------------------------

21-01-2004 17:48
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 14:23.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.063 seconds (58.97% PHP - 41.03% MySQL) con 22 query.