hi
see below code:
<div id="DPayam" runat="server" class="DPayam">
<asp:Label ID="Label33" runat="server" CssClass="lblmalek">plese click below button</asp:Label>
</div>
<div id="message" class="atten">
<asp:Label ID="Label38" runat="server" CssClass="lblatten">please enter name</asp:Label>
</div>
<asp:RequiredFieldValidator Display="Dynamic" ID="RequiredFieldValidator1" runat="server" ControlToValidate="Txtname"></asp:RequiredFieldValidator>
<script type="text/javascript">
function Validate() {
var message = document.getElementById("message");
var DPayam = document.getElementById("DPayam");
if (Page_ClientValidate()) {
message.style.display = "none";
DPayam.style.display = "block";
}
else {
DPayam.style.display = "none";
message.style.display = "block";
}
}
</script>
here I define 2 div
when run page first div show "please click on below button" and here is textbox that users should enter text on this text box if they don't enter text it will show error "please enter name" <div id=""message">
here in script I define that when click button if users don't type name it will :
<script type="text/javascript">
function Validate() {
var message = document.getElementById("message");
var DPayam = document.getElementById("DPayam");
if (Page_ClientValidate()) {
message.style.display = "none";
DPayam.style.display = "block";
}
else {
DPayam.style.display = "none";
message.style.display = "block";
}
}
</script>
but here when I don't enter name when click butoon it doesn't do any thing I mean here I expect that it will Dpayam= dispaly none and display div id message..
and below are css:
.DPayam {
float:right;
display:normal;
}
.atten {
float: right;
direction: rtl;
display: none;
color: red;
font-size: 14.5px;
width: 350px;
margin: 30px 0px 0 0;
}
best regards
neda