By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,968 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,968 IT Pros & Developers. It's quick & easy.

Problem in loading script

P: 1
Hi,
I am using asp.net. In that i used both master page and aspx page. what is my problem is, I have written the script in master page and in aspx page i have used the onclientclick event. here is my code.

MasterPage.Master:
Expand|Select|Wrap|Line Numbers
  1.     <script type="text/javascript">
  2.         function LoginValid() {
  3.             alert("hai");
  4.                 var UserName = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName");
  5.                 var Password = document.getElementById("ctl00_ContentPlaceHolder1_txtPassword");
  6.                 var v1 = document.getElementById("valid1");
  7.                 var v2 = document.getElementById("valid2");
  8.  
  9.                 if (UserName.value == "") {
  10.                     v1.style.display = "block";
  11.                     v2.style.display = "none";
  12.                     UserName.focus();
  13.                     return false;
  14.                 }
  15.                 else if (Password.value == "") {
  16.                     v2.style.display = "block";
  17.                     v1.style.display = "none"
  18.                     Password.focus();
  19.                     return false;
  20.                 }
  21.                 v1.style.display = "none";
  22.                 v2.style.display = "none";
  23.                 return true;
  24.         }
  25. }
  26. </script>
page.aspx:

Expand|Select|Wrap|Line Numbers
  1.  <asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" OnClientClick="return ValidateUR()" />
May 2 '13 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
and what about the ValidateUR() function?
May 2 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.