Current location: Hot Scripts Forums » General Web Coding » JavaScript » forms and variables


forms and variables

Reply
  #1 (permalink)  
Old 02-15-04, 12:43 PM
yngveam yngveam is offline
New Member
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
forms and variables

This is my script:

<form name=Butikk action="handlekurv.php" method=post target="butikk">

<SCRIPT language=JavaScript><!--
function visPris(){
var antall = 1;if ((Butikk._ctl0_Antall.value < 1) || isNaN(Butikk._ctl0_Antall.value) || Butikk._ctl0_Antall.value > 9999){Butikk._ctl0_Antall.value = antall;alert("Antall må være et tall mellom 1 og 999");}else{Butikk._ctl0_Antall.value = antall = parseInt(Butikk._ctl0_Antall.value);}
var Pris = new Object();Pris[0] = 124;Pris[1] = 0;Pris[2] = 160;Pris[3] = 0;Pris[4] = 420;
var sum = Number(Pris[0]);sum += Number(Pris[Butikk.harddisk.value]);sum += Number(Pris[Butikk.ram.value]);
pris.innerText = "Pris kr. " + Math.floor(sum) + ",-";
sum = sum * antall;
totalt.innerText = "Sum kr. " + Math.floor(sum) + ",-";
}
// --></SCRIPT>


<SELECT id=harddisk onchange=visPris(); name=harddisk>
<OPTION value=1 selected>20GB 5400rpm (0,-)</OPTION>
<OPTION value=2>30GB 4200rpm (160,-)</OPTION>
</SELECT>
<br><br>
<SELECT id=ram onchange=visPris(); name=ram>
<OPTION value=3 selected>Ingen</OPTION>
<OPTION value=4>256 MB soDIMM DDR PC2100 (420,-)</OPTION>
</SELECT>
<br><br>
<P id=pris></P>
<INPUT id=_ctl0_Antall maxLength=3 onchange=visPris(); value=1 name=antall>
<P id=totalt></P>

<script language=JavaScript><!--
visPris();
// --></script>

<input type="hidden" name="vare" value="Vare 1">
<input type="hidden" name="pris" value="?????">
<input type="submit" name="submit" value="Buy">

</form>

How can I get the value here:
<input type="hidden" name="pris" value="?????">
To be the same as this:
<P id=totalt></P>

Thanks for all answers!

~Yngve
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
formmail problem gscraper Perl 12 08-27-04 03:06 AM
get vars from local file into textareas paulj000 PHP 5 07-15-03 01:02 AM


All times are GMT -5. The time now is 02:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.