html - Why is this ported JavaScript from VB.NET not executing? -



html - Why is this ported JavaScript from VB.NET not executing? -

i'm taking old vb.net toy made in 2006 , trying convert html/javascript/css3, functionality can embedded in page on tumblr. however, i've managed item 99% converted vb.net form javascript form. problem is, item won't code.

this below html of body of web port:

<table id="jewelryjiddyapp"><tr> <td colspan="2"><div id="logofield"><p id="jiddymainlogo">jewelry jiddy's</p> <p id="jiddysublogo">wedding ring store</p></div></td> <td> <div class="fieldlabel" style="margin-top:25px;">model name</div> <form> <select id="modelbox"> <option id="heartsinlavaflow">hearts in lavaflow</option> <option id="scarofafrica">scar of africa</option> <option id="monkeysuncle">monkey's uncle</option> <option id="flatteringfool">flattering fool</option> <option id="stealdeal">steal deal</option> <option id="arweethearyet">arwee thearyet</option> <option id="checkbouncer">checkbouncer</option> <option id="worthyoursoul">worth-your-soul</option> <option id="therough">the rough</option> <option id="canyudrspecial">canyu dr. special</option> <option id="viderzhen">viderzhen</option> <option id="fiberglasschicken">fiberglass chicken</option> <option id="pinkpuma">pink puma</option> </select> </form> <p class="limitnotice">limit 1 model type per sale</p> </td> </tr><tr> <td> <div class="fieldlabel">number of items</div> <form id="noifield"> <input id="noi-1" name="noi" type="radio" />1 <input id="noi-2" name="noi" type="radio" />2 <input id="noi-3" name="noi" type="radio" />3 <input id="noi-4" name="noi" type="radio" />4 <input id="noi-5" name="noi" type="radio" />5 </form> <p class="limitnotice">limit 5 per sale</p> </td> <td> <div class="fieldlabel">sales code</div> <form> <select id="salebox"> <option id="normalsale">normal</option> <option id="the25off">25% off sale</option> <option id="the40off">40% off sale</option> <option id="the15off">15% senior discount</option> </select> </form> <form style="text-align:center;"> <input class="fieldlabel" id="findsalestotal" type="button" value="find sales total" onclick="findsalestotal(); homecoming true;" /> </form> </td> <td> <div class="fieldlabel">total amount due</div> <p id="finalsalestotal"></p> </td> </tr></table>

here's javascript:

<script language="javascript" type="text/javascript"> function findsalestotal() { var itemvalue; var noi; var itemtotal; var salescode; var duesanstax; var salestax = 1.06; var tad; if (document.getelementbyid('heartsinlavaflow').selected = true) {itemvalue = 190;} else if (document.getelementbyid('scarofafrica').selected = true) {itemvalue = 220;} else if (document.getelementbyid('monkeysuncle').selected = true) {itemvalue = 321.15;} else if (document.getelementbyid('flatteringfool').selected = true) {itemvalue = 118.65;} else if (document.getelementbyid('stealdeal').selected = true) {itemvalue = 5.75;} else if (document.getelementbyid('arweethearyet').selected = true) {itemvalue = 88.73;} else if (document.getelementbyid('checkbouncer').selected = true) {itemvalue = 532.9;} else if (document.getelementbyid('worthyoursoul').selected = true) {itemvalue = 6685.19;} else if (document.getelementbyid('therough').selected = true) {itemvalue = 12.18;} else if (document.getelementbyid('canyudrspecial').selected = true) {itemvalue = 86.14;} else if (document.getelementbyid('viderzhen').selected = true) {itemvalue = 121.15;} else if (document.getelementbyid('fiberglasschicken').selected = true) {itemvalue = 132.17;} else if (document.getelementbyid('pinkpuma').selected = true) {itemvalue = 93;} else {itemvalue = 0; alert("select valid model, model select error");} if (document.getelementbyid('noi-1').checked = true) {noi = 1;} else if (document.getelementbyid('noi-2').checked = true) {noi = 2;} else if (document.getelementbyid('noi-3').checked = true) {noi = 3;} else if (document.getelementbyid('noi-4').checked = true) {noi = 4;} else if (document.getelementbyid('noi-5').checked = true) {noi = 5;} else {noi = 0; alert("select number of items. number of items error");} if (document.getelementbyid('normalsale').selected = true) {salescode = 1;} else if (document.getelementbyid('the25off').selected = true) {salescode = 0.75;} else if (document.getelementbyid('the40off').selected = true) {salescode = 0.6;} else if (document.getelementbyid('the15off').selected = true) {salescode = 0.85;} else {salescode = 0; alert("invalid entry, sales code error");} itemtotal = itemvalue * noi; duesanstax = itemtotal * salescode; tad = duesanstax * salestax document.getelementbyid('finalsalestotal').innerhtml = tad;} </script>

i'm no javascript expert, script looks well-formed me. can't quite understand why won't execute @ all. when works right, total amount due field display numeric value, can parse money 1 time know readout. far, don't results. have suggestions turn thing around?

originally, part of class assignment decade ago. compiled in vb.net then, working fine. i've removed game-like "cheat" codes gave funny results, since want basic script work before making cute.

and no, don't remember how did in vb.net. haven't been doing level of programme compilation since 2007.

update: give thanks "window." advice. there's new problem: doesn't remember selections. example: when set "scar of africa," reverts "hearts in lavaflow." when set radio buttons two, reset 1. when select sale, redirected normal mode. how info choices retained before output?

ps: i've removed css, saying getting in way , not part of problem anyway.

your problem button's id findsalestotal , function's name findsalestotal.

here jsfiddle of 1 doesn't work: http://jsfiddle.net/gzej4jm5/1/ 1 work: http://jsfiddle.net/gzej4jm5/2/

the browser or javascript engine thinks trying reference dom element (your button) in onclick event.

either alter button's id, or alter name of function , update button's onclick event. did latter in working fiddle, changing function name findsalestotalfunction.

relevant html:

<input class="fieldlabel" id="findsalestotal" type="button" value="find sales total" onclick="findsalestotalfunction(); homecoming true;" />

relevant javascript:

function findsalestotalfunction()

javascript html vb.net css3 porting

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -