function updateInfo(formName)
{
var form
= document.getElementById(formName);
form.submit();
}
3.自定义html中file控件
<input type= "file" id ="fileupload" name= "fileupload" style="display :none"/>
<input type= "button" onclick ="fileupload.click()" id="uploadFileButton" value="浏
览 ..." class ="btn"/>
<input type="submit" name= "submit" value ="上传" onclick="return
ajaxFileUpload();" class="btn">
4.实现多个复选框的多选和单选
全选
function checkAll(checkall_id,
checkName) {
var checkArr
= document.getElementsByName(checkName);
var checkAll
= document.getElementById(checkall_id);
if(checkAll.checked
== true ) {
for (var i=0;
i<checkArr.length; i++) {
checkArr[i].checked = true ;
}
} else {
for (var i=0;
i<checkArr.length; i++) {
checkArr[i].checked = false ;
}
}
}
单选
function checkSingle(single_id,
checkName) {
var checkArr
= document.getElementsByName(checkName);
var checkSingle
= document.getElementById(single_id);
for( var i=0;
i<checkArr.length; i++) {
if (checkArr[i].value
!= single_id) {
checkArr[i].checked = false ;
} else {
checkArr[i].checked = true ;
}
}
}
4.在加载页面的时候调用js方法
<script type="text/javascript">
window.onload=function() //用window的onload事件,窗体加载完毕的时候
{
//do
something
}
</script>