Discussion Forums  >  Config Data, JSON, App Refresh

Replies: 14    Views: 156

LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
03/24/12 04:01 PM (13 years ago)

Help turning a code (HTML) to mobile view

ok guys i got a code (the one that I'm gonna I put down below) i need to have it on mobile view pls help how.
 
LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
like
03/24/12 04:01 PM (13 years ago)
<script language="javascript" type="text/javascript"> <!-- Original: Gordon Coverley ([email protected]) --> /* Visit http://www.yaldex.com/ for full source code and get more free JavaScript, CSS and DHTML scripts! */ <!-- Begin var tot_units = 0; var tot_cost = 0; function acbCalc(acbForm) { with (acbForm) { if (!unitsnum.value || isNaN(unitsnum.value) || !unitscost.value || isNaN(unitscost.value) ) { alert("Please re-enter the Prize on Market & Weight."); return; } else { if (saletype[0].checked) { // bought CapGain.value = ""; tot_units += unitsnum.value*1; total_units.value = tot_units; tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); acb.value = d_places(tot_cost/tot_units, 4); CapGain.value = "-- sales only --"; } else { // sold if ((unitsnum.value*-1 + tot_units*1) >= 0) { tot_units -= unitsnum.value; total_units.value = tot_units; tot_cost = tot_units * acb.value; total_cost.value = d_places(tot_cost, 4); CapGain.value = d_places(unitsnum.value*(unitscost.value - acb.value), 2); } else { alert("Please check your Input."); return; } } } } // sets the decimal precision function d_places(n,p) { var factor = 1; var ans = 0; var j = 0; for (j = 1; j <= p; j++) factor = factor * 10.0; ans = (Math.round((n + 0.05 / (factor) ) * factor)) / factor; return ans; } } // End --> </script> <center> <form> <table border="1" cellpadding="5" cellspacing="0"> <tbody> <tr> <td> <table> <tbody> <tr> <th colspan="2"> Gold Estimator <p>  </p> </th> </tr> <tr> <td> Prize on Market</td> <td> <input maxlength="10" name="unitsnum" size="15" type="text" /></td> </tr> <tr> <td> Weight in grams</td> <td> <input maxlength="10" name="unitscost" size="15" type="text" /></td> </tr> <tr> <td> Karat of Piece</td> <td> <input checked="checked" name="saletype" type="radio" value="1" />10 Karat <br /> <input name="saletype" type="radio" value="-1" />14 Karat <br /> <input name="saletype" type="radio" value="-1" />18 Karat <br /> <input name="saletype" type="radio" value="-1" />24 Karat</td> </tr> <tr> <td align="center" colspan="2"> <input onclick="acbCalc(this.form);" type="button" value="Estimate" /></td> </tr> <tr> <td> Estimation</td> <td> <input name="total_units" readonly="readonly" size="15" type="text" /></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </form> </center>
 
Skyr0s
Code is Art
Profile
Posts: 196
Reg: Jan 26, 2012
Hong Kong
4,310
like
03/24/12 07:31 PM (13 years ago)
What do you lean by mobile view? Is it iOS or Android?
 
AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
like
03/24/12 07:32 PM (13 years ago)
i couldnt be able to get the code to calculate the final price.
 
LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
like
03/24/12 09:18 PM (13 years ago)
i want it to view for IOS, APP Master thats only the layout, the codes that i need to implement for 10, 14, 18, 24 karats are not in yet i would really appreciate if you can help me. this is the equation for 10K - Prize of market x .4165 / 31.1= and the total you multiply it by the weight. this is the equation for 14K - Prize of market x .583 / 31.1= and the total you multiply it by the weight. this is the equation for 18K - Prize of market x .750 / 31.1= and the total you multiply it by the weight. this is the equation for 24K - Prize of market x .999 / 31.1= and the total you multiply it by the weight.
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
03/24/12 09:55 PM (13 years ago)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="width=device-width; initial-scale=1.0; maximum-scale=2.0; user-scalable=1;" name="viewport" /> <title>Gold Estimator</title> </head> <body> <script language="javascript" type="text/javascript"> <!-- Original: Gordon Coverley ([email protected]) --> /* Visit http://www.yaldex.com/ for full source code and get more free JavaScript, CSS and DHTML scripts! */ <!-- Begin var tot_units = 0; var tot_cost = 0; function acbCalc(acbForm) { with (acbForm) { if (!unitsnum.value || isNaN(unitsnum.value) || !unitscost.value || isNaN(unitscost.value) ) { alert("Please re-enter the units and cost amounts again."); return; } else { if (saletype[0].checked) { // bought CapGain.value = ""; tot_units += unitsnum.value*1; total_units.value = tot_units; tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); acb.value = d_places(tot_cost/tot_units, 4); CapGain.value = "-- sales only --"; } else { // sold if (saletype[1].checked) { // bought CapGain.value = ""; tot_units += unitsnum.value*1; total_units.value = tot_units; tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); acb.value = d_places(tot_cost/tot_units, 4); CapGain.value = "-- sales only --"; } else { if (saletype[3].checked) { // bought CapGain.value = ""; tot_units += unitsnum.value*1; total_units.value = tot_units; tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); acb.value = d_places(tot_cost/tot_units, 4); CapGain.value = "-- sales only --";} else { if (saletype[4].checked) { // bought CapGain.value = ""; tot_units += unitsnum.value*1; total_units.value = tot_units; tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); acb.value = d_places(tot_cost/tot_units, 4); CapGain.value = "-- sales only --";} } } } } } // sets the decimal precision function d_places(n,p) { var factor = 1; var ans = 0; var j = 0; for (j = 1; j <= p; j++) factor = factor * 10.0; ans = (Math.round((n + 0.05 / (factor) ) * factor)) / factor; return ans; } } // End --> </script> <center> <form> <table border=1 cellpadding=5 cellspacing=0><tr><td> <table> <th colspan=2>Gold Estimator <p></th> <tr> <td>Weight in grams</td> <td><input type=text name=unitsnum size=15 maxlength=10></td> </tr> <tr> <td>Price on Market</td> <td><input type=text name=unitscost size=15 maxlength=10></td> </tr> <tr> <td>Transaction Type</td> <td><input type=radio name=saletype value="1">10 Karat <br><input type=radio name=saletype value="1">14 Karat <br><input type=radio name=saletype value="1">18 Karat <br><input type=radio name=saletype value="1">24 Karat </td> </tr> <tr> <td colspan=2 align=center><input type=button value="Estimate" onClick="acbCalc(this.form);"></td> </tr> <tr> <td>Total Weight</td> <td><input type=text name=total_units size=15 readonly></td> </tr> <td>Estimate</td> <td><input type=text name=total_cost size=15 maxlength=10 readonly></td> </tr> <tr> <td>Adjusted Base Cost</td> <td><input type=text name=acb size=15 readonly></td> </tr> <tr> <td>Gain or Loss</td> <td><input type=text name=CapGain size=15 maxlength=20 readonly></td> </tr> </table> </td></tr></table> </form> </center> </body> </html>
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
03/24/12 09:57 PM (13 years ago)
Still needs tweaking, may or maynot help you.
 
LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
like
03/24/12 10:09 PM (13 years ago)
it does helps me, but can we change the weight in grams to be where the price of market is? like switch them up? and at the bottom for the estimate can we just have estimation and thats it? i really need your help
 
LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
like
03/24/12 10:24 PM (13 years ago)
it does helps me, but can we change the weight in grams to be where the price of market is? like switch them up? and at the bottom for the estimate can we just have estimation and thats it? i really need your help
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
03/24/12 11:28 PM (13 years ago)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="width=device-width; initial-scale=1.0; maximum-scale=2.0; user-scalable=1;" name="viewport" /> <title>Gold Estimator</title> </head> <body> <script language="javascript" type="text/javascript"> <!-- Original: Gordon Coverley ([email protected]) --> /* Visit http://www.yaldex.com/ for full source code and get more free JavaScript, CSS and DHTML scripts! */ <!-- Begin var tot_units = 0; var tot_cost = 0; function acbCalc(acbForm) { with (acbForm) { if (!unitsnum.value || isNaN(unitsnum.value) || !unitscost.value || isNaN(unitscost.value) ) { alert("Please re-enter the units and cost amounts again."); return; } else { if (saletype[0].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } else { // bought if (saletype[1].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } else { if (saletype[2].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } else { if (saletype[3].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } } } } } } // sets the decimal precision function d_places(n,p) { var factor = 1; var ans = 0; var j = 0; for (j = 1; j <= p; j++) factor = factor * 10.0; ans = (Math.round((n + 0.05 / (factor) ) * factor)) / factor; return ans; } } // End --> </script> <center> <form> <table border=1 cellpadding=5 cellspacing=0><tr><td> <table> <th colspan=2>Gold Estimator <p></th> <tr> <td>Price on Market</td> <td><input type=text name=unitscost size=15 maxlength=10></td> </tr> <tr> <td>Weight in Grams</td> <td><input type=text name=unitsnum size=15 maxlength=10></td> </tr> <tr> <td>Transaction Type</td> <td><input type=radio name=saletype value="1">10 Karat <br><input type=radio name=saletype value="1">14 Karat <br><input type=radio name=saletype value="1">18 Karat <br><input type=radio name=saletype value="1">24 Karat </td> </tr> <tr> <td colspan=2 align=center><input type=button value="Estimate" onClick="acbCalc(this.form);"></td> </tr> <td>Estimate</td> <td><input type=text name=total_cost size=15 maxlength=10 readonly></td> </tr> </table> </td></tr></table> </form> </center> </body> </html>
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
03/24/12 11:29 PM (13 years ago)
should work the way you want minus set prices
 
LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
like
03/25/12 12:07 PM (13 years ago)
ok is all good now, what i will do now is implement the equation, thank i appreciate it very much :D, Is there a way for the set prices to be automatically set from a website? if not is ok
 
LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
like
03/25/12 04:24 PM (13 years ago)
Or put a clear button?
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
03/25/12 08:53 PM (13 years ago)
Clear button <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="width=device-width; initial-scale=1.0; maximum-scale=2.0; user-scalable=1;" name="viewport" /> <title>Gold Estimator</title> </head> <body> <script language="javascript" type="text/javascript"> <!-- Original: Gordon Coverley ([email protected]) --> /* Visit http://www.yaldex.com/ for full source code and get more free JavaScript, CSS and DHTML scripts! */ <!-- Begin var tot_units = 0; var tot_cost = 0; function acbCalc(acbForm) { with (acbForm) { if (!unitsnum.value || isNaN(unitsnum.value) || !unitscost.value || isNaN(unitscost.value) ) { alert("Please re-enter the units and cost amounts again."); return; } else { if (saletype[0].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } else { // bought if (saletype[1].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } else { if (saletype[2].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } else { if (saletype[3].checked) { // bought tot_cost += (unitsnum.value*1) * (unitscost.value*1); total_cost.value = d_places(tot_cost, 4); } } } } } } // sets the decimal precision function d_places(n,p) { var factor = 1; var ans = 0; var j = 0; for (j = 1; j <= p; j++) factor = factor * 10.0; ans = (Math.round((n + 0.05 / (factor) ) * factor)) / factor; return ans; } } // End --> </script> <center> <form> <table border=1 cellpadding=5 cellspacing=0><tr><td> <table> <th colspan=2>Gold Estimator <p></th> <tr> <td>Price on Market</td> <td><input type=text name=unitscost size=15 maxlength=10></td> </tr> <tr> <td>Weight in Grams</td> <td><input type=text name=unitsnum size=15 maxlength=10></td> </tr> <tr> <td>Transaction Type</td> <td><input type=radio name=saletype value="1">10 Karat <br><input type=radio name=saletype value="1">14 Karat <br><input type=radio name=saletype value="1">18 Karat <br><input type=radio name=saletype value="1">24 Karat </td> </tr> <tr> <td colspan=2 align=center><input type=button value="Estimate" onClick="acbCalc(this.form);"></td> </tr> <td>Estimate</td> <td><input type=text name=total_cost size=15 maxlength=10 readonly></td> </tr> <td>Clear Data</td> <td><INPUT TYPE="button" onClick="history.go(0)" VALUE="Refresh"></td> </tr> </table> </td></tr></table> </form> </center> </body> </html>
 
LocoLopez
Code is Art
Profile
Posts: 211
Reg: Jan 12, 2012
Orlando
9,760
like
03/25/12 10:01 PM (13 years ago)
thank you that helps a lot
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.