所以我在javascript中定义了这个函数..
function varReplace(formid)
{
if (formid.factsc[0].checked == true) {
formid.adddetails.value == "it's working";
}
else {
formid.adddetails.value == "it's not working";
}
}
如果 html 中的factsc被点击“yes”,我想给adddetails一个特定的值。
在 html 方面,我这样调用该函数..
onsubmit="return varReplace(this.form)"
但是它不起作用..任何帮助将不胜感激!提前致谢!
最佳答案
您的函数没有返回任何内容。
Note that in order to cancel the submit event, the onSubmit should be in the form onSubmit="return expression". "return" indicates that the value of the expression should be returned to the submit routine. If the expression evaluates to false, the submit routine is cancelled; if it is true, the submit routine goes forward.
关于javascript - 在onsubmit中调用javascript函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5111573/