$(document).ready(function() {
//显示当前日期
var d = new Date();
var s2 = d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDay();
$('#EntTime30').val(s2);
$('#area').change(function(){
$('#show').val($(this).find("option:selected").val()) ;
});
var input1 = parseFloat($(" #input1").val());
socialsecurity(input1);
$("#input1").change(function(){
input1 = parseFloat($(this).val());
socialsecurity(input1);
});
});
function socialsecurity(input1){
if(input1*40/100 <= 2000){
al = 2000;
$("#input2").val(al);
}else if(input1*300/100 >= 20838){
al = 20838;
$("#input2").val(al);
}else{
al = input1 + 0;
$("#input2").val(al);
}
}
input1 = parseFloat($(this).val())||0;
$("#设备基数ID").val('')
谁知你怎么写的。
<!DOCTYPE html>
<html>
<head>
<script src="http://www.w3school.com.cn/jquery/jquery-1.11.1.min.js">
</script>
<script>
$(document).ready(function(){
//你把下面注释放开看看
//$("#test").val('');
});
</script>
</head>
<body>
<p>设备基数<input type='text' id='test' value='2000'/></p>
</body>
</html>
$(document).ready(function() {
//显示当前日期
var d = new Date();
var s2 = d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDay();
$('#EntTime30').val(s2);
$('#area').change(function(){
$('#show').val($(this).find("option:selected").val()) ;
});
var input1 = parseFloat($(" #input1").val());
//你开始的时候这个干嘛用的,需要吗/?
// socialsecurity(input1);
$("#input1").change(function(){
input1 = parseFloat($(this).val());
socialsecurity(input1);
});
});
你 alert($("#show").val());
$(document).ready(function() {
/* var input1 = parseFloat($(" #input1").val())||0;
var show = parseFloat($(" #show").val())||0;
var input5 = parseFloat($(" #input5").val())||0;
socialsecurity1(input1,input5,show);*/
$("#input1,#show,#input5").change(function(){
input1 = parseFloat($(this).val())||0;
show = parseFloat($(this).val())||0;
input5 = parseFloat($(this).val())||0;
alert(input5);
//alert($("#show").val());
socialsecurity1(input1,input5,show);
});
});
function socialsecurity1(input1,input5,show){
if(show*40/100 <= input1){
sl = show*40/100*input5/100;
$('#input3').val(sl);
}else if(input*300/100 > input1){
sl = show*300/100*input5/100;
$('#input3').val(sl);
}else{
sl = show*input5/100;
$('#input3').val(sl);
}
//alert(input5);
//alert($("#show").val()); alert(sl);
}
html
<tr >
<td>养老保险(个人)</td>
<td><input id="input5" type="text" value="8"><span>%</span></td>
<td><input id="input6" type="text" value="20"><span>%</span></td>
</tr>
获取到是六千
这段代码我没写错吧

都乱套了