我试图调用我在头文件中添加的JS函数.请在下面找到显示我的问题场景的代码.注意:我无法访问应用程序中的正文.每次我点击元素id="Save"时只会调用f1()但不是fun().我怎么能打电话给我fun()?请帮忙.
<!DOCTYPE html>
<html>
<head>
<script>
document.getElementById("Save").onclick = function fun()
{
alert("hello");
//validation code to see State field is mandatory.
}
function f1()
{
alert("f1 called");
//form validation that recalls the page showing with supplied inputs.
}
</script>
</head>
<body>
<form name="form1" id="form1" method="post">
State:
<select id="state ID">
<option></option>
<option value="ap">ap</option>
<option value="bp">bp</option>
</select>
</form>
<table><tr><td id="Save" onclick="f1()">click</td></tr></table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)