Hello CF-Talk,

This is basic javascript so should work in all browsers. Enjoy.

<FORM ACTION="none" METHOD="post" NAME="This_FormName" ID="This_FormName">
   <INPUT TYPE="text" NAME="Figure1" SIZE="5">
   <INPUT TYPE="text" NAME="Figure2" SIZE="5">
   <INPUT TYPE="text" NAME="Figure3" SIZE="5" 
onFocus="this.value=document.forms.This_FormName.Figure1.value*document.forms.This_FormName.Figure2.value">
</FORM>

or to be jazzy... this one might be helpful if you are using hidden or
set values you want to calculate from.

<SCRIPT LANGUAGE="JavaScript">
        function fullSikMultiplier(formname,item1,item2,item3,item4,item5) {
                if (item4 != undefined) {
                        document.forms[formname].elements[item1].value = item4;
                        }
                if (item5 != undefined) {
                        document.forms[formname].elements[item2].value = item5;
                        }
                form = document.form;
                document.forms[formname].elements[item3].value = 
document.forms[formname].elements[item1].value*document.forms[formname].elements[item2].value;
                }
</SCRIPT>

<FORM ACTION="none" METHOD="post" NAME="This_FormName2" ID="This_FormName">
        
        <INPUT TYPE="text" NAME="Figure1" SIZE="5">
        <INPUT TYPE="text" NAME="Figure2" SIZE="5">
        <INPUT TYPE="text" NAME="Figure3" VALUE="04" SIZE="5" 
onFocus="fullSikMultiplier('This_FormName2','Figure1','Figure2','Figure3')"><BR>
        
        <INPUT TYPE="hidden" NAME="Figure4" VALUE="22.50" SIZE="5">
        <INPUT TYPE="text" NAME="Figure5" SIZE="5">
        <INPUT TYPE="text" NAME="Figure6" VALUE="12" SIZE="5" 
onFocus="fullSikMultiplier('This_FormName2','Figure4','Figure5','Figure6')">
        
</FORM>

<A HREF=" "  
onClick="fullSikMultiplier('This_FormName2','Figure1','Figure2','Figure3',12,2);return 
false;">autofill the values in the first row</A><BR><BR>
<A HREF=" "  
onClick="fullSikMultiplier('This_FormName2','Figure4','Figure5','Figure6',12,2);return 
false;">autofill the values in the first row and hidden field to 12</A>

Let me know how you go.

Kind Regards,
Christopher Dawes
Dawes International

FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to