Prijsbereken script probleem
het onderstaande scriptje is enkel bruikbaar in Internet Explorer, weet iemand hoe dat komt. Als je bv. in FF bereken klikt is het totaal gewoon 0 euro...
script:
_______________________________________
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<script language="JavaScript" type="text/javascript">
//<![CDATA[
<!--
function PrijsTotaal()
{
verM = new Array(2,150,100)
stan = 0
storeSubtext = new Array()
var sub = 0
var subsel = 0
var subtext = 0
var subsubtext = 0
var subbox = 0
var subrad = 0
var totaal= 0
var txtfieldcount = 0
var addstoresubs = 0
document.form1.totaal.value=0
for (i=0;i<form1.length;i++)
{
var tempobj=form1.elements[i]
if(tempobj.type=="select-one") {subsel=document.form1.elements[i].options[document.form1.elements[i].selectedIndex].value-0+subsel;}
else if(tempobj.type=="text") {subsubtext=document.form1.elements[i].value-0;storeSubtext[txtfieldcount] = subsubtext * verM[txtfieldcount];txtfieldcount++;}
else if((tempobj.type=="checkbox") && (document.form1.elements[i].checked == true)) {subbox=document.form1.elements[i].value-0+subbox;}
else if((tempobj.type=="radio") && (document.form1.elements[i].checked == true)) {subrad=document.form1.elements[i].value-0+subrad;}
}
for(s=0;s<storeSubtext.length-1;s++) {
addstoresubs = storeSubtext[s] + addstoresubs
subtext = addstoresubs
}
sub=subsel+subtext+subbox+subrad+stan;
document.form1.temp.value = sub
sub = fdp(document.form1.temp.value, 2);
totaal=sub;
document.form1.totaal.value=totaal;
}
function fdp(n,d){
var xx = n.indexOf('.')
var l = n.length
var zstr = '0000000000000000000000'
var theInt = ''
var theFrac = ''
var theNo = ''
rfac = ''
rfacx = 0
nx = 0
var xt = parseInt(d) + 1
var rstr = '' + zstr.substring(1,xt)
var rfac = '.' + rstr + '5'
var rfacx = parseFloat(rfac)
if (xx == -1 ) { // No fraction
theFrac = zstr
theInt = "" + n
}
else if (xx == 0) {
theInt = '0'
nx = 0 + parseFloat(n) + parseFloat(rfacx)
n = nx + zstr
theFrac = '' + n.substring(1, n.length)
}
else {
theInt = n.substring(0,xx)
nx = parseFloat(n) + rfacx
n = '' + nx + zstr
theFrac = '' + n.substring(xx+1,xx + 1 + parseInt(d))
var astr = 'd = ' + d
}
theFrac = theFrac.substring(0,parseInt(d))
var ii = 0
theNo = theInt + '.' + theFrac
return theNo
}
//-->
//]]>
</script>
</head>
<body bgcolor="#A78C5C">
<form name="form1" id="form1" action="#">
<table border="0" width="100%" cellspacing="0" cellpadding="6" summary="">
<tr>
<td valign="top" align="left" width="100%" height="1"><font face="Comic Sans MS,Verdana">• De layout
moet...<br />
<br />
<select name="layout" size="1">
<option value="200">...eenvoudig zijn.</option>
<option value="350">...standaard zijn.</option>
<option value="440">...beter dan standaard zijn.</option>
</select></font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr>
<td valign="top" align="left" width="3500" height="15"><font face="Comic Sans MS,Verdana">• De intro is een...<br />
<br />
<select name="intro" size="1">
<option value="10">...Normale intropagina.</option>
<option value="25">...Kleine flashintro.</option>
<option value="0">...identieke pagina aan de rest van mijn site.</option>
</select></font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr>
<td valign="top" align="left" width="5000" height="15"><font face="Comic Sans MS,Verdana">• Hoeveel pagina's ongeveer? <br /><br /></font>
<input type="text" size="5" maxlength="3" value="" /><font face="Comic Sans MS,Verdana"> Pagina's</font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr><td valign="top" align="left" width="5980" height="7"><font face="Comic Sans MS,Verdana">• Ik wil ook een...
<br /></font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="1"><font face="Comic Sans MS,Verdana">-<input type=
"checkbox" name="mailformulier" value="5" />...mailformulier</font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="1"><font face="Comic Sans MS,Verdana">-<input type=
"checkbox" name="teller" value="0" />...bezoekers teller</font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="2"><font face="Comic Sans MS,Verdana">-<input type=
"checkbox" name="nieuws" value="5" />...nieuwssysteem</font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="21"><font face=
"Comic Sans MS,Verdana">-<input type="checkbox" name="forum" value=
"30" />...forum</font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr>
<td valign="top" align="left" width="4500" height="20"><font face="Comic Sans MS,Verdana">
<input type="hidden" name="temp" value="" /> <input type=
"button" value=" totaal " onclick=
"PrijsTotaal();" /> -> <input type="text" size="7" value=""
name="totaal" /> Euro <font size="-1" face=
"Comic Sans MS,Verdana,Tahoma,Arial">(excl. BTW)</font></font><br />
<br /></td>
</tr>
</table>
</form>
</body>
</html>
//<![CDATA[
<!--
function PrijsTotaal()
{
verM = new Array(2,150,100)
stan = 0
storeSubtext = new Array()
var sub = 0
var subsel = 0
var subtext = 0
var subsubtext = 0
var subbox = 0
var subrad = 0
var totaal= 0
var txtfieldcount = 0
var addstoresubs = 0
document.form1.totaal.value=0
for (i=0;i<form1.length;i++)
{
var tempobj=form1.elements[i]
if(tempobj.type=="select-one") {subsel=document.form1.elements[i].options[document.form1.elements[i].selectedIndex].value-0+subsel;}
else if(tempobj.type=="text") {subsubtext=document.form1.elements[i].value-0;storeSubtext[txtfieldcount] = subsubtext * verM[txtfieldcount];txtfieldcount++;}
else if((tempobj.type=="checkbox") && (document.form1.elements[i].checked == true)) {subbox=document.form1.elements[i].value-0+subbox;}
else if((tempobj.type=="radio") && (document.form1.elements[i].checked == true)) {subrad=document.form1.elements[i].value-0+subrad;}
}
for(s=0;s<storeSubtext.length-1;s++) {
addstoresubs = storeSubtext[s] + addstoresubs
subtext = addstoresubs
}
sub=subsel+subtext+subbox+subrad+stan;
document.form1.temp.value = sub
sub = fdp(document.form1.temp.value, 2);
totaal=sub;
document.form1.totaal.value=totaal;
}
function fdp(n,d){
var xx = n.indexOf('.')
var l = n.length
var zstr = '0000000000000000000000'
var theInt = ''
var theFrac = ''
var theNo = ''
rfac = ''
rfacx = 0
nx = 0
var xt = parseInt(d) + 1
var rstr = '' + zstr.substring(1,xt)
var rfac = '.' + rstr + '5'
var rfacx = parseFloat(rfac)
if (xx == -1 ) { // No fraction
theFrac = zstr
theInt = "" + n
}
else if (xx == 0) {
theInt = '0'
nx = 0 + parseFloat(n) + parseFloat(rfacx)
n = nx + zstr
theFrac = '' + n.substring(1, n.length)
}
else {
theInt = n.substring(0,xx)
nx = parseFloat(n) + rfacx
n = '' + nx + zstr
theFrac = '' + n.substring(xx+1,xx + 1 + parseInt(d))
var astr = 'd = ' + d
}
theFrac = theFrac.substring(0,parseInt(d))
var ii = 0
theNo = theInt + '.' + theFrac
return theNo
}
//-->
//]]>
</script>
</head>
<body bgcolor="#A78C5C">
<form name="form1" id="form1" action="#">
<table border="0" width="100%" cellspacing="0" cellpadding="6" summary="">
<tr>
<td valign="top" align="left" width="100%" height="1"><font face="Comic Sans MS,Verdana">• De layout
moet...<br />
<br />
<select name="layout" size="1">
<option value="200">...eenvoudig zijn.</option>
<option value="350">...standaard zijn.</option>
<option value="440">...beter dan standaard zijn.</option>
</select></font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr>
<td valign="top" align="left" width="3500" height="15"><font face="Comic Sans MS,Verdana">• De intro is een...<br />
<br />
<select name="intro" size="1">
<option value="10">...Normale intropagina.</option>
<option value="25">...Kleine flashintro.</option>
<option value="0">...identieke pagina aan de rest van mijn site.</option>
</select></font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr>
<td valign="top" align="left" width="5000" height="15"><font face="Comic Sans MS,Verdana">• Hoeveel pagina's ongeveer? <br /><br /></font>
<input type="text" size="5" maxlength="3" value="" /><font face="Comic Sans MS,Verdana"> Pagina's</font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr><td valign="top" align="left" width="5980" height="7"><font face="Comic Sans MS,Verdana">• Ik wil ook een...
<br /></font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="1"><font face="Comic Sans MS,Verdana">-<input type=
"checkbox" name="mailformulier" value="5" />...mailformulier</font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="1"><font face="Comic Sans MS,Verdana">-<input type=
"checkbox" name="teller" value="0" />...bezoekers teller</font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="2"><font face="Comic Sans MS,Verdana">-<input type=
"checkbox" name="nieuws" value="5" />...nieuwssysteem</font></td>
</tr>
<tr>
<td valign="top" align="left" width="1920" height="21"><font face=
"Comic Sans MS,Verdana">-<input type="checkbox" name="forum" value=
"30" />...forum</font><hr width="320" style="color: #000000;" align="left" /></td>
</tr>
<tr>
<td valign="top" align="left" width="4500" height="20"><font face="Comic Sans MS,Verdana">
<input type="hidden" name="temp" value="" /> <input type=
"button" value=" totaal " onclick=
"PrijsTotaal();" /> -> <input type="text" size="7" value=""
name="totaal" /> Euro <font size="-1" face=
"Comic Sans MS,Verdana,Tahoma,Arial">(excl. BTW)</font></font><br />
<br /></td>
</tr>
</table>
</form>
</body>
</html>
_____________________________________
Groetjes,
Isupporter :)
(euh: ziet er maar raar uit...http://www.i-support.be/prijsbereken.php voor de broncode)
Gewijzigd op 01/01/1970 01:00:00 door Isupporter
Er zijn nog geen reacties op dit bericht.