Forums / General Questions / I need help putting this js calculator on a ez page

I need help putting this js calculator on a ez page

Views: 835

Results 1 to 7 of 7
27 Aug 2012, 7:43 PM
#1
valsurfer101 avatar

valsurfer101

New Zenner

Join Date:
Feb 2012
Posts:
73
Plugin Contributions:
0

I need help putting this js calculator on a ez page

I need to put this js calculator on one of my ez pages. I used ck editor to copy the tables over however how do i get it to work..

this is the calculator i am trying to get on my page.
thank you
http://www.csgnetwork.com/fiflowcalc.html

28 Aug 2012, 6:20 PM
#2
valsurfer101 avatar

valsurfer101

New Zenner

Join Date:
Feb 2012
Posts:
73
Plugin Contributions:
0

Re: I need help putting this js calculator on a ez page

Is this even possible to do?

31 Aug 2012, 4:21 AM
#3
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: I need help putting this js calculator on a ez page

Create a new EZPage, making sure to FIRST TURN OFF your HTML editor. (You want to be creating/editing that new page using PLAIN TEXT mode).

Paste the following into the page:

<script language="javascript" Type="text/javascript">
<!--
var vl1 = 43.5;
var vl2 = 55.0;
var vl3 = 18.0

function compute(f) {
     f.result.value = eval( Math.sqrt( vl2 / vl1 ) * vl3 )
     f.result2.value = eval( ( Math.sqrt( vl2 / vl1 ) * vl3 ) * 10.51 )
}

function saveo( f ) {
     vl1 = f.opress.value
}

function saven( f ) {
     vl2 = f.npress.value
}

function savei( f ) {
     vl3 = f.injsize.value
}
// -->
</script>

<form name="CSGForm">
  <table align="center" border=5 cellpadding=5>
    <tr bgcolor="#B6D4D2">
     <td width=50%>
       <b>Enter Original Fuel Pressure</b>
     </td>
     <td width=50%>
       <input type="text" name="opress" size=18 onChange="saveo(this.form)">
     </td>
   </tr>
   <tr>
     <td>
       <b>Enter New Fuel Pressure</b>
     </td>
     <td>
       <input type="text" name="npress" size=18 onChange="saven(this.form)">
     </td>
   </tr>
   <tr>
     <td>
       <b>Enter Rating Of Fuel Injector (lb/hr)</b>
     </td>
     <td>
       <input type="text" name="injsize" size=18 onChange="savei(this.form)">
     </td>
   </tr>
   <tr>
     <td align=center valign=center colspan=2 bgcolor="#B6D4D2">
       <input type="button" VALUE="Calculate Injector Flow" onClick="compute(this.form)">  
       <input name="res" type="reset" value="Clear All Values">
     </td>
   </tr>
   <tr>
     <td>
       <b>New Flow Rate Of Fuel Injector</b>
     </td>
     <td>
       <input type="text" name="result" size=24>
       <b> lb/hr</b>
       <br>
       <input type="text" name="result2" size=24>
       <b> cc/min</b>
     </td>
    </tr>
  </table>
</form>
<script language="javascript">
<!-- Hide script from old browser
  document.CSGForm.opress.value = vl1;
  document.CSGForm.npress.value = vl2;
  document.CSGForm.injsize.value = vl3;
// End the hiding here. -->
</script>

Save the page.

20 years a Zencart User

31 Aug 2012, 4:24 AM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: I need help putting this js calculator on a ez page

Naturally, you will add explanatory text, and restyle the html. Currently, the styling is embedded which is not good practice.

20 years a Zencart User

6 Sep 2012, 4:48 PM
#5
valsurfer101 avatar

valsurfer101

New Zenner

Join Date:
Feb 2012
Posts:
73
Plugin Contributions:
0

Re: I need help putting this js calculator on a ez page

Thank you that worked beautifully.

How were you able to view that.

I tried viewing the source code and couldn't find it?
thank you again

7 Sep 2012, 12:38 AM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,725
Plugin Contributions:
56

Re: I need help putting this js calculator on a ez page

@SchoolBoy, would you please bundle this up and submit it to the Plugins area? People ask for this sort of thing now and again. Thanks!

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

10 Sep 2012, 9:37 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: I need help putting this js calculator on a ez page

swguy:

@SchoolBoy, would you please bundle this up and submit it to the Plugins area? People ask for this sort of thing now and again. Thanks!

All I did was grab the code on the URL provided by the OP, clean it up a bit and re-post...

As I am not sure of the proprietary of the original code (eg: copyright) I hesitate to create a mod for this.

20 years a Zencart User