how to use javascript in asp.net

Posted by Shanky11 under ASP.NET on 12/2/2012 | Points: 10 | Views : 1353 | Status : [Member] | Replies : 3
this code i hav written in page head section??????????/ in this sectoin
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"/>
-----------------------------JAVASCRIPT IS AS FOLLOWS----------------------
<script type="text/javascript"language="javascript">
function validate()
{
var Firstname = document.getElementById('<%=txtname.ClientID %>').value;
if (Firstname == "")
{
alert("Enter First Name");
document.getElementById("<%=txtname.ClientID%>").focus();
return false;
}
</script>
--------------------------------------------------
-<asp:Button ID="btnregister" runat="server"
Text="Register" OnClientClick=" return validate();"
onclick="btnregister_Click"/>




Responses

Posted by: Hariinakoti on: 12/3/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Shanky,
You are using javascript in correct format.Y u asking this question and for what? Can u explain ur doubt clearly

Thanks & Regards
Hari

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Siba_Sahoo on: 12/4/2012 [Member] Starter | Points: 25

Up
0
Down
U hv done in right way, but i think some syntax error:
wrong:
<script type="text/javascript"language="javascript">

correct :(keep space between attributes)
<script type="text/javascript" language="javascript">

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 12/10/2012 [Member] Starter | Points: 25

Up
0
Down
http://sandeep-chourasia.blogspot.in/2011/05/jquery-image-crossslider.html

Here you need to do the above example step by step to make urself aware.

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response