<分区>
我正在尝试调用我在 header 中添加的 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>