<INPUT CLASS="textboxsmallest" TYPE="text" NAME="Quantity#itemid#" SIZE="5" MAXLENGTH="5" VALUE="0"
How does it look generated?
- Calvin
----- Original Message -----
From: E Creese
To: CF-Talk
Sent: Saturday, September 27, 2003 8:47 AM
Subject: Re: New _javascript_ question
<SCRIPT LANGUAGE="_javascript_">
function format(num)
{
finished=Math.floor(num)+".";
var base=100*(num-Math.floor(num))+0.5;
finished += Math.floor(base/10);
finished += Math.floor(base%10);
return finished;
}
function subtotal(q,p)
{
stotal=q*p;
return format(stotal);
}
function calctax(current)
{
var st="WI"
var str=document.order.STATE.value.toUpperCase();
if (str.search(st) != -1) rate=0.05
else
rate=0;
tx=rate*(eval(current.Subtotal1.value)+ eval(current.Subtotal2.value)+ eval(current.Subtotal3.value)+ eval(current.Subtotal4.value)+ eval(current.Subtotal5.value)+ eval(current.Subtotal6.value)+ eval(current.Subtotal7.value)+ eval(current.Subtotal8.value)+ eval(current.Subt! otal9.value)+ eval(current.Subtotal10.value)+ eval(current.Subtotal11.value)+ eval(current.Subtotal12.value)+ eval(current.Subtotal13.value)+ eval(current.Subtotal14.value)+ eval(current.Subtotal15.value)+ eval(current.Subtotal16.value)+ eval(current.Subtotal17.value)+ eval(current.Subtotal18.value)+ eval(current.Subtotal19.value)+ eval(current.Subtotal20.value)+ eval(current.Subtotal21.value)+ eval(current.Subtotal22.value)+ eval(current.Subtotal23.value)+ eval(current.Subtotal24.value)+ eval(current.Subtotal25.value)+ eval(current.Subtotal26.value)+ eval(current.Subtotal27.value)+ eval(current.Subtotal28.value)+ eval(current.Subtotal29.value)+ eval(current.Subtotal30.value)+ eval(current.Subtotal31.value)+ eval(current.Subtotal32.value));
document.order.Tax.value=format(tx)
return format(tx);
}
function calcsh(n)
{
if (n<50) return 15
else if (n<100) return 10
else if (n<150) return 5
else return 0;
}
function total(cur! rent)
{
calctax(current); &n! bsp;
sum= eval(current.Subtotal1.value)+
eval(current.Subtotal2.value)+ eval(current.Subtotal3.value)+
eval(current.Subtotal4.value)+ eval(current.Subtotal5.value)+
eval(current.Subtotal6.value)+ eval(current.Subtotal7.value)+
eval(current.Subtotal8.value)+ eval(current.Subtotal9.value)+
eval(current.Subtotal10.value)+ eval(current.Subtotal11.value)+
eval(current.Subtotal12.value)+ eval(current.Subtotal13.value)+
eval(current.Subtotal14.value)+ eval(current.Subtotal15.value)+
eval(current.Subtotal16.value)+ eval(current.Subtotal17.value)+
eval(current.Subtotal18.value)+ eval(current.Subtotal19.value)+
eval(current.Subtotal20.value)+ eval(current.Subtotal21.value)+
eval(current.Subtotal22.value)+ eval(current.Subtotal23.value)+
&! nbsp;eval(current.Subtotal24.value)+ eval(current.Subtotal25.value)+
eval(current.Subtotal26.value)+ eval(current.Subtotal27.value)+
eval(current.Subtotal28.value)+ eval(current.Subtotal29.value)+
eval(current.Subtotal30.value)+ eval(current.Subtotal31.value)+
eval(current.Subtotal32.value);
document.order.SH.value=calcsh(sum);
sum= sum+
eval(current.Tax.value)+
eval(current.SH.value);
return format(sum);
}
</SCRIPT>
----- Original Message -----
From: Calvin Ward
To: CF-Talk
Sent: Saturday, September 27, 2003 8:04 AM
Subject: Re: New _javascript_ question
What does the first part of this code look like when you view source on the page?
- Calvin
----- Origi! nal Message -----
From: E Creese ; To: CF-Talk
Sent: Saturday, September 27, 2003 8:28 AM
Subject: OT: New _javascript_ question
Once I added CF code to this I began having problems. I am putting CF right in the _javascript_ and it is giving me a syntax error. Anybody see anything I should be doing differently.
Here is where it bombs telling me I am missing a (;)
<INPUT CLASS="textboxsmallest" TYPE="text" NAME="Quantity#itemid#" SIZE="5" MAXLENGTH="5" VALUE="0"
Here is the full code
<!! ---START PRODUCTS--->
<cfoutput query="getprods">
<tr>
! ;
<td align=center CLASS="defaulttext">
<INPUT TYPE="hidden" NAME="Item#itemid#" SIZE="40" MAXLENGTH="80" VALUE="#item_name#">
<SCRIP! T LANGUAGE="_javascript_">document.write(document.order.Item#itemid#.value);</SCRIPT>
</td>
<td align=center CLASS="defaulttext">
<INPUT CLASS="textboxsmallest" TYPE="text" NAME="Quantity#itemid#" SIZE="5" MAXLENGTH="5" VALUE="0" #.value));">
&nbs! p; </td>
&nbs! p; ; <td align=center CLASS="defaulttext">
<INPUT TYPE="hidden" NAME="Price#itemid#" SIZE="5" MAXLENGTH="5" VALUE="#dollarformat(item_cost)#">
<SCRIPT LANGUAGE="_javascript_">document.write(document.order.Price#itemid#.value);</SCRIPT>
</td>
<td align=ce! nter CLASS="defaulttext">
&nb! sp;<I NPUT CLASS="textboxsmall" TYPE="text" NAME="Subtotal#itemid#" SIZE="8" MAXLENGTH="8" VALUE="0" >
</td>
</tr>
</cfoutput>
<!---END PRODUCTS--->
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

