»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 09-02-2003, 02:41 PM   #1 (permalink)
Registered User
 
Join Date: Feb 2003
Posts: 7
Kasar is on a distinguished road
Javascript help

I haven't dealt with any of this in years, even copying a page I wrote in 1997 that does what I want doesn't work this way, so I'm obviously missing something. I have two sets of radio buttons, and based on which combination's selected, I want a value placed in a text or input box.

<HTML>
<HEAD>
<TITLE>Required Fields</TITLE>
<SCRIPT>
function fee()
{
If (Worksheet.Loan[0].checked || Worksheet.Purpose[0].checked) fee=415;
If (Worksheet.Loan[1].checked || Worksheet.Purpose[0].checked) fee=540;
If (Worksheet.Loan[2].checked || Worksheet.Purpose[1].checked) fee=490;
If (Worksheet.Loan[2].checked || Worksheet.Purpose[2].checked) fee=490;
If (Worksheet.Loan[3].checked || Worksheet.Purpose[1].checked) fee=490;
If (Worksheet.Loan[3].checked || Worksheet.Purpose[2].checked) fee=490;

document.Worksheet.MFI_MCA_FEE.value= "$" + fee;

}

</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="Worksheet">
<INPUT TYPE="RADIO" NAME="Loan" VALUE="Conventional">Conventional
<INPUT TYPE="RADIO" NAME="Loan" VALUE="FHA">FHA
<INPUT TYPE="RADIO" NAME="Loan" VALUE="VA">VA
<br>
<INPUT TYPE="RADIO" NAME="Purpose" VALUE="Purchase">Purchase
<INPUT TYPE="RADIO" NAME="Purpose" VALUE="Refi">Refinance
<br>
Your total is: <br>
<INPUT TYPE="text" name="MFI_MCA_FEE" size=10 maxlength=10 tabindex=30 onFocus="fee()">
</FORM>
</BODY>
</HTML>

Kasar is offline   Reply With Quote
Old 09-02-2003, 02:54 PM   #2 (permalink)
Registered User
 
digital_d_17's Avatar
 
Join Date: Oct 2001
Location: Bellevue, WA
Posts: 92
digital_d_17 is on a distinguished road
Send a message via ICQ to digital_d_17 Send a message via AIM to digital_d_17 Send a message via Yahoo to digital_d_17
your code should read more like this:


if (Worksheet.Loan[0].checked || Worksheet.Purpose[0].checked)
{fee=415;}
else if (Worksheet.Loan[1].checked || Worksheet.Purpose[0].checked)
{fee=540;}
else if (Worksheet.Loan[2].checked || Worksheet.Purpose[1].checked)
{fee=490;}
else if (Worksheet.Loan[2].checked || Worksheet.Purpose[2].checked)
{fee=490;}
else if (Worksheet.Loan[3].checked || Worksheet.Purpose[1].checked)
{fee=490;}
else if (Worksheet.Loan[3].checked || Worksheet.Purpose[2].checked)
{fee=490;}

FYI: You many have to use document.forms or something like that to make it work accross all browsers. Also, make sure that you want to be using the OR (||) operators instead of the AND (&&) operators.
__________________
-Digital D.
digital_d_17 is offline   Reply With Quote
Old 09-02-2003, 04:36 PM   #3 (permalink)
Registered User
 
Join Date: Feb 2003
Posts: 7
Kasar is on a distinguished road
You called it right, they were the wrong operators. Thanks for the rewrite, there's more to be added yet to the if-then options but that shouldn't be a problem.

I still can't seem to get the result into the text box though. I used a working page to model from, but apparently not correctly.
Kasar is offline   Reply With Quote
Old 09-03-2003, 02:53 PM   #4 (permalink)
Registered User
 
Join Date: Feb 2003
Posts: 7
Kasar is on a distinguished road
Got it

The document.forms didn't make sense to me, but adding document. to each did make it work.

Thanks.
Kasar is offline   Reply With Quote
Reply




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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 09:47 PM.