I tried to write a function in a js file and another function with the same name on the page. I was expecting an error, but there was no error, and I only got the function from the js file to execute. How is this possible. Even if I write a function in a separate js file, everything will be displayed in a single html file. Then, as possible
<script type="text/javascript" language="javascript" src="JScript.js" />
<script language="javascript">
function Boo()
{
alert("Hai new");
}
</script>
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button runat=server OnClientClick="Boo();" Text="Click" />
</div>
</form>
</body>
and in js file
function Boo() {
alert("Hai");
}
source
share