Jump to content

Custom Code Help on SquareSpace Needed

Shpadee

Hey! My dad's switching his site over to Square Space from Homestead. He has a calculator for his website (currently hosted on Homestead) to find the price of a product according to the dimensions of the product. However, the same code he's using in Homestead is NOT working in Square Space. I'm not very good with code and I don't know whether it has something to do with languages or what. Any help would be appreciate! Thanks!

 

 

Here's the website with the calculator on it: http://www.eastcoasttinning.com/pricing.html

(Also, if there's a different way of executing this that's better than this, please let me know. Thanks again!)

 

Here's the code he's using:

<p><font face="Georgia"><font color="#000000" size="2"><strong>Cost
 Calculator</strong><br/>Enter diameter and height of pan to the
 <u>nearest</u> inch. </font></font></p>
 <table style="WIDTH: 200px; HEIGHT: 80px" cellspacing="0"
 cellpadding="0" width="200" summary="" border="0">
     <tbody>
         <tr>
             <td width="75"><font face=" Georgia " size="2"><font
 color="#000000">Diameter:</font></font></td>
             <td>&#160;<input onkeypress="javascript:findcost();"
 id="diameter" size="3" />&#160;inches </td>
         </tr>
         <tr>
             <td><font face="Georgia " size="2"><font
 color="#000000">Height:</font></font></td>
             <td>&#160;<input onkeypress="javascript:findcost();"
 id="height" size="3" width="25" /> inches</td>
         </tr>
         <tr>
             <td><font face=" Georgia " size="2"><font
 color="#000000">Price $:</font></font></td>
             <td id="Price"><font face=" Georgia " size="2"><font
 color="#000000">&#160;&#160;&#160;&#160;---</font></font></td>
         </tr>
     </tbody>
 </table>


 <script language="Javascript">
 function findcost()
  {
 var dia = document.getElementById("diameter").value;
 var height = document.getElementById ("height").value;

 if( IsNumeric(dia) && IsNumeric(height) ) {setTimeout("displaycost()",60);}
 else {
 document.getElementById("Price").innerHTML = '<font size="2" face="
 Georgia "><font color="#000000">' + "&#160;&#160;&#160;&nbsp---" +
 "</font></font>"
        }
 }

 function displaycost(dia,height)
 {
 var dia = document.getElementById("diameter").value;
 var height = document.getElementById("height").value;

 if( IsNumeric(dia) && IsNumeric(height) && (height!="") && dia!="")
                       {
 dia = parseInt(dia);
 height = parseInt(height);
 //      alert(dia+height);
 document.getElementById("Price").innerHTML = '<font size="2"
 face="Georgia"><font color="#00000">&#160;&#160;&#160;&#160;$' +
 5*(dia + (2*height)) + "</font></font>"
                      }
 else {
 document.getElementById("Price").innerHTML = '<font size="2"
 face="Georgia"><font color="#000000">' + "&#160;&#160;&#160;&nbsp--- "
 + "</font></font>"
         }
 }

 function IsNumeric(sText)

 {
    var ValidChars = "0123456789.";
    var IsNumber=true;
    var Char;


    for (i = 0; i < sText.length && IsNumber == true; i++)
       {
       Char = sText.charAt(i);
       if (ValidChars.indexOf(Char) == -1)
          { IsNumber = false;}
       }
    return IsNumber;
  }

Link to comment
Share on other sites

Link to post
Share on other sites

SquareSpace might not support JavaScript

He who asks is stupid for 5 minutes. He who does not ask, remains stupid. -Chinese proverb. 

Those who know much are aware that they know little. - Slick roasting me

Spoiler

AXIOM

CPU- Intel i5-6500 GPU- EVGA 1060 6GB Motherboard- Gigabyte GA-H170-D3H RAM- 8GB HyperX DDR4-2133 PSU- EVGA GQ 650w HDD- OEM 750GB Seagate Case- NZXT S340 Mouse- Logitech Gaming g402 Keyboard-  Azio MGK1 Headset- HyperX Cloud Core

Offical first poster LTT V2.0

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×