Jump to content

jiyeonnie

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by jiyeonnie

  1. [/left][left]<form>[/left][left]<fieldset id="field"><legend>Oversea Currency Rates</legend><dl><dt><label for="currency">Currency</label></dt><dd><select id="cur" name="cur"><option value="SGD">SGD</option><option value="USD">USD</option><option value="EUR">EUR</option><option value="GBP">GBP</option><option value="CNY">CNY</option><option value="JPY">JPY</option><option value="KRW">KRW</option></select><input type="text" size="16" required="required" id="curr" placeholder="Enter Amount" /></dd></dl><dl><dt><label for="to">Convert to</label></dt><dd><select id="next" name="next"><option value="SGD">SGD</option><option value="USD">USD</option><option value="EUR">EUR</option><option value="GBP">GBP</option><option value="CNY">CNY</option><option value="JPY">JPY</option><option value="KRW">KRW</option></select></dd></dl><br /><dl><dt></dt><dd><input type="button" onclick="convert()" value=" Convert " /><input type="reset" value=" Reset "/></dd></dl><dl><dt><label for="cost">Converted Amount</label></dt><dd><input type="text" size="16" disabled="disabled" id="final"/></dd></dl></fieldset> function convert() { var CurSel = cur.options[cur.selectedIndex].value; var amt = document.getElementById("curr").value; var final = document.getElementById("final").value; var next = next.options[next.selectedIndex].value;[/left] if (CurSel == "SGD") { switch (next) { case "SGD": final = amt * 0.05; break; case "USD": final = amt * 0.10; break; case "GBP": final = amt * 0.15; break; case "CNY": final = amt * 5.0; break; case "JPY": final = amt * 63.0; break; case "KRW": final = amt * 680.40; break; } } else if (CurSel == "USD") { ~Same as above~ } else if (CurSel == "EUR") { ~Same as above~ } else if (CurSel == "GBP") { ~Same as above~ } else if (CurSel == "CNY") { ~Same as above~ } else if (CurSel == "JPY") { ~Same as above~ } else if (CurSel == "KRW") { } } I have learnt how to locate one Dropdown list in JavaScript, however... i tried another file with 2 DDL and i cant seem to make it work... Tried "trouble-shooting" it myself and wasted lots of time ~~ So i'm getting professional help! Thanks in advance!
  2. <html><head><title>Korean Language School</title><script type="text/javascript"> function apply() { document.frm.sub.disabled = true; if (document.frm.chk.checked == true) { document.frm.sub.disabled = false; } if (document.frm.chk.checked == false) { document.frm.sub.enabled = false; } }</script></head><body><form id="apply" action="" name="frm"> <fieldset> <legend>Customer Information</legend> <dl> <dt><label for="name">Name</label></dt> <dd><input type="text" placeholder="First & Last Name" required="required" id="name"/></dd> </dl> <dl> <dt><label for="email">Email</label></dt> <dd><input type="email" placeholder="asklc@hotmail.com" required="required" id="email"/></dd> </dl> <dl> <dt><label for="gender">Gender</label></dt> <dd><input type="radio" name="gender"/>Male <input type="radio" name="gender"/> Female</dd> </dl> <dl> <dt><label for="contact">Contact Details</label></dt> <dd><input type="text" value="+65" required="required" id="contact"/></dd> </dl> <dl> <dt><label for="Ask">Have you learnt Korean Before?</label></dt> <dd><input type="radio" name="Ask" />Yes <input type="radio" name="Ask" />No</dd> </dl> </fieldset> <fieldset> <legend>Class Information</legend> <dl> <dt><label for="Course">Which Course Are you taking?</label></dt> <dd><input type="radio" name="course" />Basic Course<br /><input type="radio" name="course" />Intermediate Course<br /><input type="radio" name="course" />Advanced Course</dd> </dl> <dl> <dt><label for="frequency">How often will you like the class to be?</label></dt> <dd><input type="radio" name="freq" />Twice a week<br /><input type="radio" name="freq" />Once a Week<br /><input type="radio" name="freq" />Once Every 2 Weeks</dd> </dl> <dl> <dt><label for="time">What days do you prefer your lesson to be?</label></dt> <dd><input type="checkbox" name="time" />Weekday<br /><input type="checkbox" name="time" />Saturday<br /><input type="checkbox" name="time" />Sunday</dd> </dl> <dl> <dt></dt> <dd style="padding-left: 100px;">I have agree to the <a href="#">Terms & Condition</a> <input type="checkbox" name="chk" onClick="apply()"></dd> </dl> <dl> <dt></dt> <dd><input type="button" name="sub" value=" Submit " disabled="disabled" onclick="submit()"><input type="reset" value=" Reset "/></dd> </dl> </fieldset> </form> I got my Javascript from a site [sorry, i've forgotten where] When i click on my " I have agree to the Terms & Condition " checkbox, my submit button becomes clickable again. However, when i tried this, <script type="text/javascript"> function apply() { document.frm.sub.disabled = true; if (document.frm.chk.checked == true && document.frm.course.checked== true && document.frm.freq.checked == true && document.frm.time.checked == true) { document.frm.sub.disabled = false; } if (document.frm.chk.checked == false && document.frm.course.checked == false && document.frm.freq.checked == false && document.frm.time.checked == false) { document.frm.sub.enabled = false; } }</script> No matter what i have checked, the submit button stays "Disabled" all the time.
  3. >.< I starred at it for quite some time and still dont get it.. omg. *Edit! I found it >.< I got an extra 's' on the element!!! Omg ~_~ Thanks so much again!
  4. Hey, i tried doing the codes again and i found another problem. For my radio buttons, only my first radio button ( Less than 20) Is not working. However, the second and third radio button is working well. I Checked and the wording are actually same. <script type="text/javascript"> function CalculateSO() { var amt = document.getElementsByName('soAMT')[0].value; var bank = document.getElementsByName('bank')[0]; var selectedbank = bank.options[bank.selectedIndex].value; if (selectedbank == "DBS" || selectedbank == "OCBC" || selectedbank == "UOB") { if (document.getElementById("less20").checked == true) { document.getElementByName("soCost")[0].value = (amt * 0.010); } else if (document.getElementById("21-50").checked == true) { document.getElementsByName("soCost")[0].value = (amt * 0.015); } else { document.getElementsByName("soCost")[0].value = (amt * 0.020); } } else if (selectedbank == "HSBC" || selectedbank == "SChart") { if (document.getElementById("less20").checked == true){ document.getElementByName("soCost")[0].value = (amt * 0.020); } else if (document.getElementById("21-50").checked == true){ document.getElementsByName("soCost")[0].value = (amt * 0.025); } else { document.getElementsByName("soCost")[0].value = (amt * 0.030); } } else{ if (document.getElementById("less20").checked == true){ document.getElementByName("soCost")[0].value = (amt * 0.025); } else if (document.getElementById("21-50").checked == true) { document.getElementsByName("soCost")[0].value = (amt * 0.030); } else{ document.getElementsByName("soCost")[0].value = (amt * 0.035); } } } </script> <form name="soCharge" action="" method="post"> <fieldset> <legend>Charges for Standing Order</legend> <dl> <dt><label for="Amount">Amount Transferred:</label></dt> <dd><input type="number" name="soAMT" id="soAMT" size="16" maxlength="8" placeholder="Amount in SGD" step="1000"/></dd> </dl> <dl> <dt><label for="Bank">Name of Recieving Bank</label></dt> <dd> <select size="1" name="bank" id="bank"> <option value="DBS">DBS/POSB Bank</option> <option value="OCBC">OCBC Bank</option> <option value="UOB">UOB Bank</option> <option value="HSBC">HSBC Bank</option> <option value="SChart">Standard Chartered Bank</option> <option value="CITI">CitiBank</option> </select> </dd> </dl> <dl> <dt><label for="people">Number of Standing orders</label></dt> <dd> <input type="radio" value="less20" name="people" id="less20"/> Below 20 <input type="radio" value="21-50" name="people" id="21-50"/> 21-50 <input type="radio" value="more51" name="people" id="more51"/> Above 51 </dd> </dl> <dl> <dt></dt> <dd><input type="button" name="Calculate" value=" Calculate " onclick="CalculateSO()" /> <input type="reset" name="reset" value=" Reset "/></dd> </dl> <dl> <dt><label for="cost">Total Cost of Transfer</label></dt> <dd><input type="text" name="soCost" size="16"/></dd> </dl> </fieldset> </form>
  5. Thank you everyone! Thanks for your suggestion and help! My codes are working well now! Cheers!
  6. Hello people, i need help on my HTML5 Form with javascript. I have been looking over and over at my textbook as reference to do the scripting. [some with google] However, i dont seem to be able to generate a answer out from my codes. Does anyone know why and how i can fix it?Your help is deeply appreciated! Thank you! Here are my codes <script type="text/javascript"> function CalculateMEPS() { var amt = document.getElementsByName('mepsAMT').value; var bank = document.getElementsByName('bank').value; var selectedbank = document.getElementsByName('bank').options[bank.selectedIndex].value; if (selectedbank == "DBS" || selectedbank == "OCBC" || selectedbank == "UOB") { document.getElementsByName('mepsCost').value = (amt * 0.003); } else if (selectedbank == "HSBC" || selectedbank == "SChart") { document.getElementsByName('mepsCost').value = (amt * 0.005); } else { document.getElementsByName('mepsCost').value = (amt * 0.007); } } </script> <form name="mepsCharge" action="" method="post"><fieldset><legend>Charges for MEPS</legend><label for="Amount">Amount Transferred:</label><input type="text" name="mepsAMT" id="mepsAMT" size="16" maxlength="8" /> <label for="Bank">Name of Recieving Bank</label> <select size="1" name="bank" id="bank"> <option value="DBS">DBS/POSB Bank</option> <option value="OCBC">OCBC Bank</option> <option value="UOB">UOB Bank</option> <option value="HSBC">HSBC Bank</option> <option value="SChart">Standard Chartered Bank</option> <option value="CITI">CitiBank</option> </select> <input type="button" name="Calculate" value="Calculate" onclick="CalculateMEPS()" /> <label for="cost">Total Cost of Transfer</label><input type="text" name="mepsCost" size="16"/></fieldset></form>
×
×
  • Create New...