Solved

external javascript

Posted on 2010-11-15
26
340 Views
Last Modified: 2012-06-22
hey i was wondering if i can convert my internal javascript to external javascript?

here is my internal js:

i have document.getElementById('<%= lblthesistotlalcost.ClientID %>') which is problem.


<script type="text/javascript" language="javascript">

    function ValidateText(i)

{   

    if(i.value.length>0)

    {

      i.value = i.value.replace(/[^\d]+/g, '');

       var a = Number(i.value.replace(/[^\d]+/g, ''));

       var a = Number(a*0.32);

       var b = Number(document.getElementById('<%= txtCPages.ClientID %>').value);

       var b = Number(b*3.81);

       var d = Number(document.getElementById('<%= txtCopiespages.ClientID %>').value);

       var c = (a+b)*d;

       var e = Number(document.getElementById('<%= txtCPages.ClientID %>').value);

       var f = Number(document.getElementById('<%= txtBWPages.ClientID %>').value);

       

       if((e+f)>=105 && (e+f)<164)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       if((e+f)>=165 && (e+f)<214)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=215 && (e+f)<274)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

        if((e+f)>=275 && (e+f)<324)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=325 && (e+f)<384)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=385 && (e+f)<454)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=454)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='';

       }

       

       if((e+f)<=104)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }



       document.getElementById('<%= lblTotalPrinting.ClientID %>').value =(c).toFixed(2);

       document.getElementById('<%= lblprintprice.ClientID %>').innerText =(c).toFixed(2); 

       document.getElementById('<%= lblprintprice.ClientID %>').textContent =(c).toFixed(2); 

       

       var bindings = Number(document.getElementById('<%= lblBinding.ClientID %>').value);

       var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

       

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(c +  bindings +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(c +  bindings +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(c +  bindings +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value = ((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC+delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC+delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC+delivery).toFixed(2);

    }   

    else 

    {

        var txtcolo= Number(document.getElementById('<%= txtCPages.ClientID %>').value);

        txtcolo = txtcolo * 3.81;

        

        document.getElementById('<%= lblTotalPrinting.ClientID %>').value = (txtcolo).toFixed(2);

        document.getElementById('<%= lblprintprice.ClientID %>').innerText =(txtcolo).toFixed(2);

        document.getElementById('<%= lblprintprice.ClientID %>').textContent =(txtcolo).toFixed(2);

        

        var bindings = Number(document.getElementById('<%= lblBinding.ClientID %>').value);

        var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

        var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

        document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(txtcolo +  bindings +extra ).toFixed(2);

        document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(txtcolo +  bindings +extra).toFixed(2);

        document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(txtcolo +  bindings +extra).toFixed(2);

        

        document.getElementById('<%= lblVatCost.ClientID %>').value = ((txtcolo +  bindings +extra + delivery)*0.14).toFixed(2); 

        document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((txtcolo +  bindings +extra + delivery)*0.14).toFixed(2);

        document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((txtcolo +  bindings +extra + delivery)*0.14).toFixed(2);

        

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC+delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC+delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC+delivery).toFixed(2);

    }



}



function ValidateText2(i)

{   

    if(i.value.length>0)

    {

       i.value = i.value.replace(/[^\d]+/g, '');

       var a = Number(i.value.replace(/[^\d]+/g, ''));

       var a = Number(a*3.81);

       var b = Number(document.getElementById('<%= txtBWPages.ClientID %>').value);

       var b = Number(b*0.32);

       var d = Number(document.getElementById('<%= txtCopiespages.ClientID %>').value);

       var c = (a+b)*d;

       

       var e = Number(document.getElementById('<%= txtCPages.ClientID %>').value);

       var f = Number(document.getElementById('<%= txtBWPages.ClientID %>').value);

       

       if((e+f)>=105 && (e+f)<164)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       if((e+f)>=165 && (e+f)<214)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=215 && (e+f)<274)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

        if((e+f)>=275 && (e+f)<324)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=325 && (e+f)<384)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=385 && (e+f)<454)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       

       if((e+f)>=454)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='';

       }

       

       if((e+f)<=104)

       {

          document.getElementById('<%= txtSpine2.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine3.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine4.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine5.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine6.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine7.ClientID %>').style.display='none';

          document.getElementById('<%= txtSpine8.ClientID %>').style.display='none';

       }

       document.getElementById('<%= lblTotalPrinting.ClientID %>').value =(c).toFixed(2); 

       document.getElementById('<%= lblprintprice.ClientID %>').innerText =(c).toFixed(2); 

       document.getElementById('<%= lblprintprice.ClientID %>').textContent =(c).toFixed(2);  

       

       var bindings = Number(document.getElementById('<%= lblBinding.ClientID %>').value);

       var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(c +  bindings +extra ).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(c +  bindings +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(c +  bindings +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value = ((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText = ((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent = ((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2);

    }

    else

    {

        var txtblk = Number(document.getElementById('<%= txtBWPages.ClientID %>').value);

        txtblk = txtblk * 0.32;

        

        document.getElementById('<%= lblTotalPrinting.ClientID %>').value = (txtblk).toFixed(2);

        document.getElementById('<%= lblprintprice.ClientID %>').innerText =(txtblk).toFixed(2);

        document.getElementById('<%= lblprintprice.ClientID %>').textContent =(txtblk).toFixed(2);

        

        var bindings = Number(document.getElementById('<%= lblBinding.ClientID %>').value);

        var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

        var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

        document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(txtblk +  bindings +extra).toFixed(2);

        document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(txtblk +  bindings +extra).toFixed(2);

        document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(txtblk +  bindings +extra).toFixed(2);

         

        document.getElementById('<%= lblVatCost.ClientID %>').value = ((txtblk +  bindings +extra + delivery)*0.14).toFixed(2);

        document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((txtblk +  bindings +extra + delivery)*0.14).toFixed(2);

        document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((txtblk +  bindings +extra + delivery)*0.14).toFixed(2);

        

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC+delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC+delivery).toFixed(2);

    }

}



function ValidateText3(i)

{

    if(i.value.length>0)

    {

       i.value = i.value.replace(/[^\d]+/g, '');

       var a = Number(i.value.replace(/[^\d]+/g, ''));

       var b = Number(document.getElementById('<%= txtCPages.ClientID %>').value);

       var b = Number(b*3.81);

       var d = Number(document.getElementById('<%= txtBWPages.ClientID %>').value);

       var d = Number(d*0.32);

       var c = (d+b)*a;

       

       document.getElementById('<%= lblTotalPrinting.ClientID %>').value =(c).toFixed(2);

       document.getElementById('<%= lblprintprice.ClientID %>').innerText =(c).toFixed(2); 

       document.getElementById('<%= lblprintprice.ClientID %>').textContent =(c).toFixed(2); 

        

       var bindings = Number(document.getElementById('<%= lblBinding.ClientID %>').value);

        var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(c +  bindings +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(c +  bindings +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(c +  bindings +extra).toFixed(2);

        

       document.getElementById('<%= lblVatCost.ClientID %>').value = ((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText = ((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent = ((c +  bindings +extra + delivery)* 0.14).toFixed(2);

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC+ delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC+ delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC+ delivery).toFixed(2); 

    }

    else 

    {

      var z =0.00;

      document.getElementById('<%= lblTotalPrinting.ClientID %>').value =(z).toFixed(2);

      document.getElementById('<%= lblprintprice.ClientID %>').innerText =(z).toFixed(2);

      document.getElementById('<%= lblprintprice.ClientID %>').textContent =(z).toFixed(2);

      

      var bindings = Number(document.getElementById('<%= lblBinding.ClientID %>').value);

      var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

      var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

      document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(z +  bindings +extra).toFixed(2);

      document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(z +  bindings +extra).toFixed(2);

      document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(z +  bindings +extra).toFixed(2);

      

      document.getElementById('<%= lblVatCost.ClientID %>').value =((z +  bindings +extra + delivery)*0.14).toFixed(2); 

      document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((z +  bindings +extra + delivery)*0.14).toFixed(2); 

      document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((z +  bindings +extra + delivery)*0.14).toFixed(2); 

      

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2);

    }

}



function ValidateText4(i)

{

    if(i.value.length>0)

    {

       i.value = i.value.replace(/[^\d]+/g, '');

       var a = Number(i.value.replace(/[^\d]+/g, ''));

       var b = Number(document.getElementById('<%=txtNovalite.ClientID %>').value);

       var d = Number(document.getElementById('<%=txtturnaround.ClientID %>').value);

       var w = Number(document.getElementById('<%=txtWiro.ClientID %>').value);

       w =  w* 35.53;

       if(d==178.39)

       {

         var c = (b*178.39)+(a*234.35)+w;

         

         if((a + b+ w)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

       }

       else

       {

         var c = (b*122.89)+(a*177.51)+w;

         

         if((a + b+ w)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         } 

       }

              

       var printing = Number(document.getElementById('<%= lblTotalPrinting.ClientID %>').value);

        var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(c+  printing  +extra ).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(c+  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(c+  printing  +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value = ((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((c +  printing  +extra + delivery)*0.14).toFixed(2);  

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2); 

    }

    else 

    {

       var novel = Number(document.getElementById('<%=txtNovalite.ClientID %>').value);

       var d = Number(document.getElementById('<%=txtturnaround.ClientID %>').value);

       novel = novel * d;

       var Wiro = Number(document.getElementById('<%=txtWiro.ClientID %>').value);

       Wiro = Wiro * 35.53;

       

       document.getElementById('<%= lblBinding.ClientID %>').value = (novel+Wiro).toFixed(2);

       document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(novel+Wiro).toFixed(2); 

       document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(novel+Wiro).toFixed(2);

       

       var printing = Number(document.getElementById('<%= lblTotalPrinting.ClientID %>').value);

       var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(novel+  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(novel+  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(novel+  printing  +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value =((novel+  printing  +extra + delivery)*0.14).toFixed(2); 

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((novel+  printing  +extra + delivery)*0.14).toFixed(2); 

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((novel+  printing  +extra + delivery)*0.14).toFixed(2);  

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2);  

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2);  

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2);    

    }

}



function ValidateText5(i)

{

   if(i.value.length>0)

    {

       i.value = i.value.replace(/[^\d]+/g, '');

       var a = Number(i.value.replace(/[^\d]+/g, ''));

       var b = Number(document.getElementById('<%=txtCalOxford.ClientID %>').value);

       var d = Number(document.getElementById('<%=txtturnaround.ClientID %>').value);

       var w = Number(document.getElementById('<%=txtWiro.ClientID %>').value);

       w = w* 35.53;

       

       if(d==122.89)

       {

         var c = (b*177.51)+(a*122.89)+w;

         

         if((a + b+ w)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

       }

       else

       {

         var c = (a*178.39)+(b*234.35)+w;

         

         if((a + b+ w)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         } 

       }

       

       var printing = Number(document.getElementById('<%= lblTotalPrinting.ClientID %>').value);

       var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(c +  printing  +extra ).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(c +  printing  +extra ).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(c +  printing  +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value =((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((c +  printing  +extra + delivery)*0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2); 

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2); 

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2);

    }

    else 

    {

       var oxford = Number(document.getElementById('<%=txtCalOxford.ClientID %>').value);

       var d = Number(document.getElementById('<%=txtturnaround.ClientID %>').value);

       oxford = oxford * d;

       var Wiro = Number(document.getElementById('<%=txtWiro.ClientID %>').value);

       Wiro = Wiro * 35.53;

       

       document.getElementById('<%= lblBinding.ClientID %>').value = (oxford + Wiro).toFixed(2);

       document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(oxford + Wiro).toFixed(2);

       document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(oxford + Wiro).toFixed(2);

       

       var printing = Number(document.getElementById('<%= lblTotalPrinting.ClientID %>').value);

        var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(oxford+  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(oxford+  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(oxford+  printing  +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value = ((oxford+  printing  +extra + delivery)*0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((oxford+  printing  +extra + delivery)*0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((oxford+  printing  +extra + delivery)*0.14).toFixed(2);

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2);

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2);

    }

}



function ValidateText6(i)

{

   if(i.value.length>0)

    {

       i.value = i.value.replace(/[^\d]+/g, '');

       var a = Number(i.value.replace(/[^\d]+/g, ''));

       var b = Number(document.getElementById('<%=txtCalOxford.ClientID %>').value);

       var n = Number(document.getElementById('<%=txtNovalite.ClientID %>').value);

       var d = Number(document.getElementById('<%=txtturnaround.ClientID %>').value);

       w = a* 35.53;

         

       if(d==122.89)

       {

         var c = (b*177.51)+(n*122.89)+w;

         

         if((n + b+ a)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

       }

       else

       {

         var c = (n*178.39)+(b*234.35)+w;

         

         if((n + b+ a)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         } 

       } 

             

       var printing = Number(document.getElementById('<%= lblTotalPrinting.ClientID %>').value);

       var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(c +  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(c +  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(c +  printing  +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value =((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((c +  printing  +extra + delivery)*0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2); 

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2); 

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2);

    }

    else 

    {

       var a = Number(document.getElementById('<%=txtWiro.ClientID %>').value);

       var b = Number(document.getElementById('<%=txtCalOxford.ClientID %>').value);

       var n = Number(document.getElementById('<%=txtNovalite.ClientID %>').value);

       var d = Number(document.getElementById('<%=txtturnaround.ClientID %>').value);

       w = a* 35.53;

         

       if(d==122.89)

       {

         var c = (b*177.51)+(n*122.89)+w;

         

         if((n + b+ a)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

       }

       else

       {

         var c = (n*178.39)+(b*234.35)+w;

         

         if((n + b+ a)>= 3)

         {

            c = c -(c * 0.20);

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         }

         else

         { 

            document.getElementById('<%= lblBinding.ClientID %>').value =(c).toFixed(2);

            document.getElementById('<%= lblbindingprice.ClientID %>').innerText =(c).toFixed(2); 

            document.getElementById('<%= lblbindingprice.ClientID %>').textContent =(c).toFixed(2); 

         } 

       } 

              

       var printing = Number(document.getElementById('<%= lblTotalPrinting.ClientID %>').value);

       var extra = Number(document.getElementById('<%= lblextra.ClientID %>').innerHTML);

       var delivery = Number(document.getElementById('<%= lblDelivery.ClientID %>').innerHTML);

        

       document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value =(c +  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').innerText =(c +  printing  +extra).toFixed(2);

       document.getElementById('<%= lblthesiscost.ClientID %>').textContent =(c +  printing  +extra).toFixed(2);

       

       document.getElementById('<%= lblVatCost.ClientID %>').value =((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       document.getElementById('<%= lblthesisvatcost.ClientID %>').innerText =((c +  printing  +extra + delivery)*0.14).toFixed(2);

       document.getElementById('<%= lblthesisvatcost.ClientID %>').textContent =((c +  printing  +extra + delivery)*0.14).toFixed(2); 

       

       var TC = Number(document.getElementById('<%= lblTotlalThesisCost.ClientID %>').value);

       var VC = Number(document.getElementById('<%= lblVatCost.ClientID %>').value);

       

       document.getElementById('<%= lblTotalCost.ClientID %>').value = (TC+VC + delivery).toFixed(2); 

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').innerText = (TC+VC + delivery).toFixed(2); 

       document.getElementById('<%= lblthesistotlalcost.ClientID %>').textContent  = (TC+VC + delivery).toFixed(2);

    }

}

    </script>

Open in new window

0
Comment
Question by:JCWEBHOST
26 Comments
 
LVL 92

Expert Comment

by:objects
ID: 34134358
yes you can create a jsp/servlet that generates and returns your javascript
same concept as a normal page except you return js instead of html
remember to change the content type
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134366
How about defining the ClientIDs as javascript global variables  in your ASP.Net page, like this:
<script type="text/javascript" language="javascript">
var txtCPages = '<%= txtCPages.ClientID %>';
var txtCopiespages = '<%= txtCopiespages.ClientID %>';
...

</script>

Open in new window


So you can replace all your client id in your quoted code to:

<script type="text/javascript" language="javascript">
    function ValidateText(i)
{   
    if(i.value.length>0)
    {
      i.value = i.value.replace(/[^\d]+/g, '');
       var a = Number(i.value.replace(/[^\d]+/g, ''));
       var a = Number(a*0.32);
       var b = Number(document.getElementById(txtCPages).value);
       var b = Number(b*3.81);
       var d = Number(document.getElementById(txtCopiespages).value);
       var c = (a+b)*d;
...
}

Open in new window


and the script can be saved as external javascript file and reference in your ASP.Net page.
0
 

Author Comment

by:JCWEBHOST
ID: 34134385
sorry please explan again?
0
 
LVL 2

Expert Comment

by:getnitincr
ID: 34134386
just copy ur entire internal script to a seperate file name it as with .js extension . for example myspace.js

adda a reference to this page as'
<script language="javascript" type="text/javascript" src=" myspace.js"> </script>
0
 

Author Comment

by:JCWEBHOST
ID: 34134395
where does this code go:

<script type="text/javascript" language="javascript">
var txtCPages = '<%= txtCPages.ClientID %>';
var txtCopiespages = '<%= txtCopiespages.ClientID %>';
...

</script>


and how do i link the external js file ?
0
 

Author Comment

by:JCWEBHOST
ID: 34134429
and the global variables?
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134434
This script should be within your original ASP.NET page:

<script type="text/javascript" language="javascript">
var txtCPages = '<%= txtCPages.ClientID %>';
var txtCopiespages = '<%= txtCopiespages.ClientID %>';
...

</script>

To link to the external js file, you may follow getnitincr's comment.
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134444
The above code will define the global variables for use in your external javascript.
0
 

Author Comment

by:JCWEBHOST
ID: 34134469
i am getting this error

Object doesn't support this property or method
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134576
textContent is not supported for IE
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134614
0
 

Author Comment

by:JCWEBHOST
ID: 34134620
what can i use?
0
 

Author Comment

by:JCWEBHOST
ID: 34134675
here is my js

  function ValidateBlackPages(i)
{  
    if(i.value.length>0)
    {
      i.value = i.value.replace(/[^\d]+/g, '');
       document.getElementById(Copies).value =i.toFixed(2);
       document.getElementById(Copies).innerText=i.toFixed(2);
      }

}




and here is my code

    <script src="js/JScript.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        var BlackPages = '<%= txtBlackPages %>';
        var ColourPages = '<%= txtColourPages.ClientID %>';
        var txtCopies = '<%= txtCopies.ClientID %>';
        var TotalPrintingCost = '<%= lblTotalPrintingCost.ClientID %>';
        var Copies = '<%= txtCopies.ClientID %>';
    </script>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:JCWEBHOST
ID: 34134689
but i still get the same error
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134702
As quoted in my above link, when you are using IE, then it will fall to use innerText. If you are using FF, then it will fall into textContent.
0
 

Author Comment

by:JCWEBHOST
ID: 34134784
yes, so i changed the file js to

  function ValidateBlackPages(i)
{  
    if(i.value.length>0)
    {
      i.value = i.value.replace(/[^\d]+/g, '');
       document.getElementById(Copies).innerText=i.toFixed(2);
      }

}


but i still get the same error
0
 

Author Comment

by:JCWEBHOST
ID: 34134865
Please Help?
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134869
I think it should be:

document.getElementById(Copies).innerText=i.value.toFixed(2);
0
 

Author Comment

by:JCWEBHOST
ID: 34134879
nope still not working.


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
     <script type="text/javascript">
        var BlackPages = '<%= txtBlackPages %>';
        var ColourPages = '<%= txtColourPages.ClientID %>';
        var txtCopies = '<%= txtCopies.ClientID %>';
        var TotalPrintingCost = '<%= lblTotalPrintingCost.ClientID %>';
        var Copies = '<%= txtCopies.ClientID %>';
    </script>
    <script src="js/JScript.js" type="text/javascript"></script>  
    </asp:Content>



js file



  function ValidateBlackPages(i)
{  
    if(i.value.length>0)
    {
      i.value = i.value.replace(/[^\d]+/g, '');
      document.getElementById(Copies).innerText=i.value.toFixed(2);
      }

}



textbox



<asp:TextBox ID="txtBlackPages" runat="server" CssClass="textbox" Width="35px" onkeyup="ValidateBlackPages(this)"></asp:TextBox>
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134895
Can you please print the alert  like this:

  function ValidateBlackPages(i)
{  
    alert("I1 = " + i.value);
    if(i.value.length>0)
    {
      i.value = i.value.replace(/[^\d]+/g, '');
      alert("I2 = " + i.value);
      alert("Copies = " + Copies);
      alert("I3 = " + i.value.toFixed(2));
      document.getElementById(Copies).innerText=i.value.toFixed(2);
      }

}
0
 

Author Comment

by:JCWEBHOST
ID: 34134914
the 3 alert works but when it comes to the

document.getElementById(Copies).innerText=i.value.toFixed(2);


i get the error
0
 

Author Comment

by:JCWEBHOST
ID: 34134920
the ffg is the output:

2
2
ctl00_ContentPlaceHolder1_txtCopies
and i get an error
0
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34134924
How about

alert("I3 = " + parseFloat(i.value).toFixed(2));
0
 

Author Comment

by:JCWEBHOST
ID: 34134952
my external js:


  function ValidateBlackPages(i)
{  
    alert("I1 = " + i.value);
    if(i.value.length>0)
    {
      i.value = i.value.replace(/[^\d]+/g, '');
      alert("I2 = " + i.value);
      alert("Copies = " + Copies);
      alert("I3 = " + i.value.toFixed(2));
      alert("I3 = " + parseFloat(i.value).toFixed(2));
      document.getElementById(Copies).innerText=i.value.toFixed(2);
      }

}


input on textbox s


output alert
5
5
ctl00_ContentPlaceHolder1_txtCopies
Error: Object doesn't support this property or method
0
 
LVL 1

Accepted Solution

by:
tuxnani earned 500 total points
ID: 34135331
even using alert could be no proper solution. Use div and use innerHTML string to output the results and you can comfortably use external js
0
 

Author Closing Comment

by:JCWEBHOST
ID: 34144251
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now