我有一個函數,我很早前寫了很好的工作,但我想通過在Javascript中執行相同的工作來加快進程並減少服務器負載。轉換服務器端vb.net到客戶端javascript
我似乎能夠獲取文本框值好,但我似乎無法設置文本框的值(我是一個JS noob)。任何人都可以將我的VB.NET代碼轉換爲它的JS等價物嗎?
Protected Sub txtSellingPrice_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles txtSellingPrice.TextChanged
Dim SellingPrice As Double = Double.Parse(txtSellingPrice.Text.Replace("$", ""))
Dim BallanceSheet As Double = If(txtBalanceSheet.Text = "", 0, Double.Parse(txtBalanceSheet.Text.Replace("$", "")))
Dim DownPayment As Double = If(txtDownPayment.Text = "", 0, Double.Parse(txtDownPayment.Text.Replace("$", "")))
txtGoodWill.Text = SellingPrice - BallanceSheet
txtBalance.Text = SellingPrice - DownPayment
txtSellingPriceMult.Text = SellingPrice
End Sub
我已經得到了這個目前爲止,但我不知道如何獲得更多。
function txtSellingPrice_OnChange() {
var txtSellingPrice = document.getElementById('<%=txtSellingPrice.ClientID %>')
var txtBalanceSheet = document.getElementById('<%=txtBalanceSheet.ClientID %>')
var txtDownPayment = document.getElementById('<%=txtDownPayment.ClientID %>')
}