Go Back   Computer Forums > Welcome To Computer Forums .org > Social Lounge | Off Topic
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 11-22-2008, 05:50 AM   #1
Fully Optimized
 
ssc456's Avatar
 
Join Date: Jan 2007
Posts: 4,279
Send a message via MSN to ssc456
Default Java/Html Help

Morning Guys,

Hopefully just a quick question im assuming with the wide variety of people we have on here someone will know the anser to my question.

I'm very farmiliar with Excel and have a formular id like to intergrae in my website. I've used Visual Basic and from that i can see that the majority of languages will have the same principle but with different wording.

heres my form.

Code:
<form id="form1" name="form1" method="post" action="">
        <label>
        <div align="center"><span class="style3">Total Mileage:
          </span>
          <input type="text" name="mile" id="mile" value="" />
        </div>
        </label>
        <div align="left"><br />
        </div>
        <label>
        
        <div align="left">
          <input type="radio" name="radio" id="bus" value="bus" />
          <span class="style3">Business</span></div>
        </label>
        <div align="left"></div>
        <label>
        
        <div align="left">
          <input type="radio" name="radio" id="res" value="res" />
          <span class="style3">Resedential</span></div>
        </label>
        <div align="center"><br />
          <span class="style3">Cost Of Delivery:</span><br />
        </div>
        <label>
        <div align="center">
          <input type="text" name="sum" id="sum" />
        </div>
        </label>
        <div align="center"><br />
          <input type="button" name="Calculate" id="Calculate" value="Calculate" onclick = calculate()/>
          <br />
        </div>
        <label></label>
        <br />
          </form>
ok heres what i want. when you click calculate button,

lookup the value in mile then if radio button res is ticked times by 0.6 if the bus is ticked times by 0.55 and display the answer in sum.

can someone help me please?

Thanks
__________________

__________________
He who has never failed has never attempted anything worth succeeding at.

Dont Eat Animals, Its Not Good For Them And They Dont Like It!
ssc456 is offline   Reply With Quote
Old 11-23-2008, 12:39 PM   #2
Site Team
 
David Lindon's Avatar
 
Join Date: Dec 2002
Posts: 15,233
Default Re: Java/Html Help

You should change the name of radio as this is probably a reserved name and change the subsequent code.

var TotalMileage = document.form1.mile.value;
var RadioValue = document.form1.radio.value;
var Total = document.form1.sum;
if(RadioValue == "bus"){
Total.sum = TotalMileage * 0.6;
}
if(RadioValue == "res"){
Total.sum = TotalMileage * 0.55;
}
__________________

__________________
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote
Old 11-24-2008, 09:35 AM   #3
Fully Optimized
 
ssc456's Avatar
 
Join Date: Jan 2007
Posts: 4,279
Send a message via MSN to ssc456
Default Re: Java/Html Help

thanks david i did manage to resolve this issue now.

turns out i had to change them from raido to rad
__________________
He who has never failed has never attempted anything worth succeeding at.

Dont Eat Animals, Its Not Good For Them And They Dont Like It!
ssc456 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off



All times are GMT -5. The time now is 09:52 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0