调用<表单>

Calling function from <form>

本文关键字:表单 gt lt 调用      更新时间:2023-09-26

我知道您不能在像<form id"form" onload="javascript:test()">一样的<form>中使用onLoad属性,只能在<body> 中使用

我的问题是,当加载表单时,是否有任何属性可以放入来调用函数,或者有其他方法可以做到这一点?

编辑:

这是吗

<form jwcid="form">
<script>
function checkForChange() {
var approvalStatus = document.getElementById('licensingStatus').value;
if(approvalStatus == "Pass"){
    document.getElementById('licensingApprovalDate').setAttribute("validators", "validators:maxDateToday,required");
} else {
    document.getElementById('licensingApprovalDate').setAttribute("validators", "validators:maxDateToday");
}   
}
</script>
.....

Forms不使用外部数据来构建它们(主体可以加载图像,iframe可以加载外部文档,等等)。

因此:

</form>
<script> /* The form has loaded. Do your stuff */ </script>

"表单已加载"是什么意思?我想你的意思是"提交表格时"。属性为"onsubmit":<form id="form" onsubmit="javascript:test()">

无论是否提交表格,你的恐惧都必须返回真或假。