2016-05-24 12 views
0
<!DOCTYPE html> 

<html> 

    <head> 
      <title>Nitro Motorbike</title> 
      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" /> 
      <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> 
      <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> 
      <script src="SydCalculation.js"></script> 
      <script src="MelCalculation.js"></script> 
      <script src="QLDCalculation.js"></script> 
      <script src="PerthCalculation.js"></script> 
      <script src="TotalSalesCalculation.js"></script> 

      <meta name="viewport" content="initial-scale=1, maximum-scale=1"> 
    </head> 

<body> 

    <div data-role="page" data-title="Nitro Motorbike"> 
      <!-- Header--> 
      <div data-role="header"> 
       <h1>Nitro Motorbike Total Sales Calculation Screen of All the Stores</h1> 

      <input type="button" value="Home" id="btnAdd" data-inline="true" data-icon="home" data-iconpos="right" 
      onclick="window.location.href='file:///F:/programming%20business%20apps/Assignment/Nitro%20Motorbikemain%20page%20JQuery.html'"> 
      </div> 

      <!-- Main--> 
      <div data-role="main" class="ui-content"> 


&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 


<img id="Bike" src="bike8.jpg" height="500" width="1000" align="center" /> 
       </div> 

       <form name ="totalSaleForm" > 
        <div class="ui-field-contain"> 
         <label for="txtTotalAmountSyd">Sales by Sydney Store (in $) </label><br> 
         <input type="text" name="txtTotalAmountSyd" id="txtTotalAmountSyd" Disabled> <br> 
         <label for="txtTotalAmountMel"> Sales by Melbourne Store (in $)</label><br> 
         <input type="text" name="txtTotalAmountMel" id="txtTotalAmountMel" Disabled><br> 
         <label for="txtTotalAmountQLD"> Sales by Queensland Store (in $)</label><br> 
         <input type="text" name="txtTotalAmountQLD" id="txtTotalAmountQLD" Disabled ><br> 
         <label for="txtTotalAmountPerth"> Sales by Perth Store (in $)</label><br> 
         <input type="text" name="txtTotalAmountPerth" id="txtTotalAmountPerth" Disabled><br> 
         <label for="txttotalGrossProfit"> Total Gross Profit (in $)</label><br> 
         <input type="text" name="txttotalGrossProfit" id="txttotalGrossProfit" Disabled><br> 


      <input type="button" value="Calculate" id="btnAdd" data-inline="true" data-icon="check" data-iconpos="right" 
      onclick="Process()"> <br><br><br><br> 

      <input type="button" value="Next"id="btnAdd" data-inline="true" data-icon="carat-r" data-iconpos="right" 
      onclick="window.location.href='file:///F:/programming%20business%20apps/Assignment/TotalNetProfitJquery.html'" /><br> <br> 


</form> 
      </div> 

      <!-- Footer --> 
      <div data-role="footer"> 
       <h4>Copyright Nitro Motorbike</h4> 
      </div> 
    </div> 

</body> 
</html> 

を見つけるために一緒にそれらを追加すると、私は私の以前のJavaScriptファイルから値を取得するために使用している私の機能ですが、私はないですこれが正しいかどうか確かめてください。はJavaScriptで他の関数から値を取得し、別のJavaScript関数で再びそれらを使用して、次の新しい結果

function addTotalSalesDB() { 
    var sql; 

    sql = "INSERT INTO Widgets VALUES ("; 
    sql = sql + totalAmountSyd +", "; 
    sql = sql + totalAmountMel + "', "; 
    sql = sql + totalAmountQLD + ", "; 
    sql = sql + totalAmountPerth + ")"; 

    db.transaction(function (tx) { 
      tx.executeSql(sql); 
    }); 

    PrepareForm(); 
} 

function PrepareForm() { 

    totalSaleForm.txtTotalAmountSyd.value = ""; 
    totalSaleForm.txtTotalAmountMel.value = ""; 
    totalSaleForm.txtTotalAmountQLD.value = ""; 
    totalSaleForm.txtTotalAmountPerth.value = ""; 

    totalSaleForm.txttotalGrossProfit.focus(); 
} 


function Process() { 


    totalAmountSyd = totalSaleForm.txtTotalAmountSyd.value; 
    totalAmountMel= totalSaleForm.txtTotalAmountMel.value; 
    totalAmountQLD =totalSaleForm.txtTotalAmountQLD.value; 
    totalAmountPerth = totalSaleForm.txtTotalAmountPerth.value; 

    txttotalGrossProfit.value= totalAmountSyd+totalAmountMel+totalAmountQLD+totalAmountPerth; 
} 
+0

で必要なものを行うその後

var field1 = jQuery('#field1').val(); 

設定とjQueryを使用して値を取得する、すなわち

ことができます。 'sql =" INSERT INTO Widgets VALUES( ";' – JohannesB

+0

[Javascriptの変数の範囲]を見てください(http://stackoverflow.com/questions/500431/what-is-the-scope-of-variables-in- – JohannesB

+0

あなたの「質問」を理解するのは本当に分かりません。何を達成したいですか? – AxelH

答えて

0

他の機能に渡す値とともに非表示フィールドを使用します。あなたは、私はこれについては悪い感じがありますフィールド1

関連する問題