我有這個javascript和它的工作很好在asp.net ,,,但我嘗試這個腳本在PHP中的相同的例子,但不工作什麼是錯的?將JavaScript轉換爲PHP Javascript
我已經拉布勒包括價值,,我嘗試讓拉布勒價值和隱藏字段插入,
這是我的腳本
<script type="text/javascript">
function Calculate() {
var Txt_Percent = document.getElementById('<%= txt_Percent.ClientID %>');
var Txt_Fix = document.getElementById('<%= txt_Fix.ClientID %>');
if (document.getElementById('<%= rad_Fix.ClientID %>').checked == true) {
document.getElementById('txt_Percent').disabled = true;
var lblReadCost = document.getElementById('<%= lbl_Read_Cost.ClientID %>');
var lblReadCostValue;
var Lab_Read_Net = document.getElementById('<%= lbl_Read_Net.ClientID %>');
var hf_Read_Net = document.getElementById('<%= hf_Read_Net.ClientID %>');
if (navigator.appName == 'Netscape')
lblReadCostValue = lblReadCost.textContent;
else
lblReadCostValue = lblReadCost.innerText;
if (navigator.appName == 'Netscape')
Lab_Read_Net.textContent = (eval(lblReadCostValue) - eval(Txt_Fix.value));
else
Lab_Read_Net.innerText = (eval(lblReadCostValue) - eval(Txt_Fix.value));
hf_Read_Net.value = (eval(lblReadCostValue) - eval(Txt_Fix.value));
if (document.getElementById('<%= txt_Fix.ClientID %>').value == '') {
Lab_Read_Net.innerText = (eval(lblReadCostValue));
}
}
if (document.getElementById('<%= rad_Percent.ClientID %>').checked == false) {
Txt_Percent.value = "";
}
}
</script>
<script type="text/ecmascript">
function Calculate1() {
var Txt_Fix = document.getElementById('<%= txt_Fix.ClientID %>');
var Txt_Percent = document.getElementById('<%= txt_Percent.ClientID %>');
if (document.getElementById('<%= rad_Percent.ClientID %>').checked == true) {
document.getElementById('txt_Fix').disabled = true;
var lblReadCost1 = document.getElementById('<%= lbl_Read_Cost.ClientID %>');
var lblReadCostValue1;
var Lab_Read_Net = document.getElementById('<%= lbl_Read_Net.ClientID %>');
var hf_Read_Net = document.getElementById('<%= hf_Read_Net.ClientID %>');
if (navigator.appName == 'Netscape')
lblReadCostValue1 = lblReadCost1.textContent;
else
lblReadCostValue1 = lblReadCost1.innerText;
if (navigator.appName == 'Netscape')
Lab_Read_Net.textContent = (eval(lblReadCostValue1) - eval(Txt_Percent.value));
var x = (eval(lblReadCostValue1) * eval(Txt_Percent.value)/100);
Lab_Read_Net.innerText = (eval(lblReadCostValue1) - parseInt(x));
hf_Read_Net.value = (eval(lblReadCostValue1) - parseInt(x));
if (document.getElementById('<%= txt_Percent.ClientID %>').value == '') {
Lab_Read_Net.innerText = (eval(lblReadCostValue1));
}
}
if (document.getElementById('<%= rad_Fix.ClientID %>').checked == false) {
Txt_Fix.value = "";
}
}
</script>
真正使用你需要一個轉換器?只是改變你的ID –