How to call javascript function in asp.net content page.
<%@ Page Title="" Language="C#" MasterPageFile="~/Common.master" AutoEventWireup="true" CodeFile="EmployeeLogin.aspx.cs" Inherits="EmployeeLogin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style type="text/css">
.button_example{
border:1px solid #7eb9d0; -webkit-border-radius: 3px; -moz-border-radius: 3px;border-radius: 3px;font-size:12px;font-family:arial, helvetica, sans-serif; padding: 10px 10px 10px 10px; text-decoration:none; display:inline-block;text-shadow: -1px -1px 0 rgba(0,0,0,0.3);font-weight:bold; color: #FFFFFF;
background-color: #a7cfdf; background-image: -webkit-gradient(linear, left top, left bottom, from(#a7cfdf), to(#23538a));
background-image: -webkit-linear-gradient(top, #a7cfdf, #23538a);
background-image: -moz-linear-gradient(top, #a7cfdf, #23538a);
background-image: -ms-linear-gradient(top, #a7cfdf, #23538a);
background-image: -o-linear-gradient(top, #a7cfdf, #23538a);
background-image: linear-gradient(to bottom, #a7cfdf, #23538a);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#a7cfdf, endColorstr=#23538a);
}
.button_example:hover{
border:1px solid #5ca6c4;
background-color: #82bbd1; background-image: -webkit-gradient(linear, left top, left bottom, from(#82bbd1), to(#193b61));
background-image: -webkit-linear-gradient(top, #82bbd1, #193b61);
background-image: -moz-linear-gradient(top, #82bbd1, #193b61);
background-image: -ms-linear-gradient(top, #82bbd1, #193b61);
background-image: -o-linear-gradient(top, #82bbd1, #193b61);
background-image: linear-gradient(to bottom, #82bbd1, #193b61);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#82bbd1, endColorstr=#193b61);
}
.auto-style2 {
width: 123px;
height: 39px;
}
.auto-style3 {
height: 39px;
}
</style>
<div style="margin-left:10px; background-color:white; margin-top:2px; width: 873px;">
<table class="style1" style="height: 21px; width: 524px; margin-top: 0px; margin-left:330px">
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Welcome to HICAL" style= Font-Size="X-Large" ForeColor="#000066" Font-Names="Harrington"></asp:Label>
</td>
</tr>
</table>
<table class="style1" style="height: 21px; width: 524px; margin-top: 0px; margin-left:295px">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Start with YOUR INDUCTION!!" style= Font-Size="X-Large" ForeColor="#000066" Font-Names="Harrington"></asp:Label>
</td>
</tr>
</table>
<table class="style1" style="height: 21px; width: 411px; margin-top: 0px; margin-left:300px">
<tr>
<td class="style2" style="width: 123px">
<asp:label runat="server" text="Employee ID" Font-Names="Aparajita" Font-Size="X-Large" style="color: #000066; font-weight: 700"></asp:label>
</td>
<td>
<asp:TextBox ID="empid" runat="server" Width="160px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:label runat="server" text="Password" Font-Names="Aparajita" Font-Size="X-Large" style="color: #000066; font-weight: 700"></asp:label>
</td>
<td class="auto-style3">
<asp:TextBox ID="emppwd" runat="server" Width="160px" TextMode="Password">*</asp:TextBox>
</td>
</tr>
<tr>
<td class="style2" style="width: 123px"></td>
<td>
<asp:Button ID="Login" runat="server" CssClass="button_example" Text="Enter" Width="89px" Height="30px" OnClick="Login_Click"/>
<asp:Button ID="Back" runat="server" CssClass="button_example" Text="Back" Width="89px" Height="30px" OnClick="Back_Click" />
</td>
</tr>
</table>
</div>
</asp:Content>
Master page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Common.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="script.js"></script>
<title>Learning Management System</title>
<link rel="stylesheet" href="mystyle.css">
<style type="text/css">
body {
padding-left: 11em;
font-family: Aparajita;
color: white;
background-color:#9CBBF4;
height: 576px;
}
.auto-style1 {
width: 886px;
height: 417px;
}
</style>
</head>
<body>
<form id="form1" runat="server" style="background-color:white; width:895px; margin-left:80px ">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/LRMS Banner.jpg" Width="896px" Height="180px" />
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server" >
</asp:contentplaceholder>
<table style="height: 315px">
<tr>
<td style="vertical-align:top; color: white" class="auto-style1">
<div style="margin-left: 100px; height: 97px; width: 689px; text-align:justify; text-justify:inter-word; color: #000066; font-weight: 700">
<h6><p><b>Important:</b> This is a restricted access site and is intended for the exclusive use by employees of Hical Technologies Ltd. (Hical). Hical reserves all rights to the site and any violation or unauthorized access to the site will be dealt in accordance with the applicable laws.</p></h6>
<h6><p><b>Employees:</b> You are required to strictly abide by Hical Information and Security policies, especially in maintaining the confidentiality of your Hical ID and Password. Any unauthorized use, distribution or transmission of the contents of the site for public or commercial purposes is strictly prohibited. Any copies made from the site, whether hardcopy or electronic, must be handled with confidentiality and the use of such information shall be restricted only to the intended use. In the event of suspicion of a security breach or unauthorized access, it must be immediately reported to Hical IT Team. You agree to comply with applicable laws and regulations governing the use of computer and telecommunication technology. Violation may result in immediate loss of computer access privileges and disciplinary action by Hical. Any suspected criminal violation shall be reported to the appropriate regulatory and/or law enforcement agencies.</p></h6>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
Javascript codefunction UserValidate()
{
var EmployeeID, Password
EmployeeID = document.getElementById("empid").value;
Password = document.getElementById("emppwd").value;
if (EmployeeID == '' && Password == '') {
alert("Please enter Employee ID and Password");
return false;
}
if (EmployeeID = '') {
alert("Please enter Employee ID");
return false;
}
if (Password = '') {
alert("Please enter Password");
return false;
}
return true;
}
What are the steps to call js file in content page. I am tried everything its not working. Pls help