2012-02-19 29 views
1

首先說新的jQuery和建設應用程序。J查詢數學移動應用程序

我有在jQuery的移動文本輸入字段我想執行數學函數。

http://unionxtreme.com/apps/Calculator/

<form> 
    <label>Width</label> 
    <!--- store current DOM ---> 
    <input type="hidden" name="currentDOM" id="currentDOM"> 
    <input type="text" name="width" data-inline="true" id="width" maxlength="8" disabled="disabled" /> 
    <label>Length</label> 
    <input type="text" name="length" data-inline="true" id="length" maxlength="8" disabled="disabled" /> 

    <a href="keypad.html" data-role="button" onclick="setFocus('width')" data-iconpos="right" data-inline="true" data-rel="dialog" data-transition="pop" data-icon="arrow-l">Width</a> 
    <a href="keypad.html" data-role="button" onclick="setFocus('length')" data-iconpos="right" data-inline="true" data-rel="dialog" data-transition="slidedown" data-icon="arrow-l">Length</a> 
    <label for="roof-slider">Roof Pitch:</label> 
    <input type="range" name="slider" id="roof-slider" value="15" min="0" max="20" /> 



</form> 

這裏是我的jQuery

$(document).ready(function() { 
    $('input[type="button"]').live('click',function() { 
     if ($("#currentDOM").val() != "") 
     { 
      var getCurrDom = $("#currentDOM").val(); 
      var existingCount = $("#typeMessage").text(); 
      if ($(this).val() == "Delete") 
      { 
       var mylength = existingCount.length; 
       var actlength = mylength - 1; 
       var str1 = existingCount.substring(0,actlength); 
       $("#typeMessage").text(str1); 
      } 
      else if ($(this).val() == "Set Number") 
      { 
       document.getElementById(getCurrDom).value = $("#typeMessage").text(); 
       $('#keypad').dialog('close'); 
      } 
      else 
      { 
       if (existingCount.length < document.getElementById(getCurrDom).maxLength) 
       { 
        var AddCount = existingCount + $(this).val(); 
        $("#typeMessage").text(AddCount); 
       } 
      } 
     } 
    }); 
    $('input[type="text"]').live('click',function() { 
     var getDOM = $(this).attr("id"); 
     $("#currentDOM").val(getDOM); 
    }); 
    }); 



    function setFocus(DOMname) 
    { 
    $("#currentDOM").val(DOMname); 
    $("#typeMessage").text("");  
    } 

要乘以寬*長*屋頂滑塊我用我自己的輸入墊。任何建議最好的方式來做到這一點?

回答

0

你的問題有點含糊。

乘以寬度*長度*屋頂滑塊的最佳方式是什麼?

實現自己的鍵盤的最佳方式是什麼?

乘法是容易的,下式是在那裏。

創建自己的數字鍵盤似乎是在浪費時間。你是否知道你可以簡單地將輸入類型改爲「數字」,大多數手機只會拉起數字鍵盤? http://www.w3schools.com/html5/html5_form_input_types.asp