1.取下拉框选中的值及文本
取值:var x=$('#demo5').val();
取文本: var x=$("#demo5 option:selected").text()
$("input[name='StCompanyCN']").val($("select[name='Company'] option:selected").text())
2.取单选按钮的值
$("input[name='isAllDept']:checked").val()
设计说明:
1. StVenF1为下拉框,它的值是在onload时赋的,在审批中时,此域值为空,如何优化
在下拉框域放另外一个文本域,StVenF1Info,用于存放StVenF1的值
2. 在onload 时,将StVenF1值赋值给StVenF1Info
var SI =[];
$("option","select[name='StVenF1']").each(function(){
SI.push($(this).text()+"|"+$(this).val());
});
document.all.StVenF1Info.value= SI.join(";");
本文介绍了一种优化方案,通过额外的隐藏字段来保存下拉框的选择值,确保即使在页面加载过程中也能保留用户的选择状态。此外,还提供了获取下拉框值和单选按钮值的方法。
1025

被折叠的 条评论
为什么被折叠?



