Using JavaScript which I wrote in html in an asp.net page <p>I am currently engaged in doing a registration page. I first did it up in html and it let me move between my login, registration and forgot password forms, which were all located on the same page in html, but the form just changed shape and features through the JavaScript to become a login form password form and registration form depending on which link is clicked.</p> <p>It worked fine in html, but in asp.net, it doesn't work at all.</p> <p>Am new to asp.net, as have always worked in html.</p> <p>Does anyone know how to get the javaScript code working in asp.net.</p> <p>The Javascript code is at the end of this asp.net page</p> <pre><code> &lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="registration.aspx.cs" Inherits="DocStore_asp.registration" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;DocStore Registration &amp; Login Page&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt; &lt;meta name="description" content="Expand, contract, animate forms with jQuery wihtout leaving the page" /&gt; &lt;meta name="keywords" content="expand, form, css3, jquery, animate, width, height, adapt, unobtrusive javascript"/&gt; &lt;link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/&gt; &lt;link rel="stylesheet" type="text/css" href="registrationcss/registrationstyle.css" /&gt; &lt;script src="js/cufon-yui.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/ChunkFive_400.font.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; Cufon.replace('h1', { textShadow: '1px 1px #fff' }); Cufon.replace('h2', { textShadow: '1px 1px #fff' }); Cufon.replace('h3', { textShadow: '1px 1px #000' }); Cufon.replace('.back'); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div class="wrapper"&gt; &lt;h1&gt;DocStore Registration &amp; Login &lt;/h1&gt; &lt;h2&gt;&lt;/h2&gt; &lt;div class="content"&gt; &lt;div id="form_wrapper" class="form_wrapper"&gt; &lt;form class="register active" action="registered_users.aspx" method="post" id="regusers" &gt; &lt;h3&gt;Register&lt;/h3&gt; &lt;p&gt;&lt;/p&gt; &lt;h2&gt;Please fill out the form below to register for a DocStore Account. Access your account today!&lt;/h2&gt; &lt;p&gt;&lt;strong&gt; - Note: Fields with an asterik (*) are required.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt; - Note: Password must contain at least 8 characters.&lt;/strong&gt;&lt;/p&gt; &lt;/form&gt; &lt;div class="column"&gt; &lt;div&gt; &lt;label&gt;*Company Name:&lt;/label&gt; &lt;input type="text" name="company_name"/&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;*Company Address:&lt;/label&gt; &lt;input type="text" name="company_address" /&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;*Address Line 2:&lt;/label&gt; &lt;input type="text" name="address_line2" /&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div&gt; &lt;label&gt;*Town:&lt;/label&gt; &lt;input type="text" name="town"/&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;*City:&lt;/label&gt; &lt;input type="text" name="city"/&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;*County:&lt;/label&gt; &lt;input type="text" name="county"/&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div&gt; &lt;label&gt;*First Name&lt;/label&gt; &lt;input type="text" name="first_name"/&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;*Surname&lt;/label&gt; &lt;input type="text" name="surname" /&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;*Email Address&lt;/label&gt; &lt;input type="text" name="useremail"/&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div&gt; &lt;label&gt;*Username&lt;/label&gt; &lt;input type="text" name="username"/&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;asp:Label ID="lblpassword" runat="server" Text="Password"&gt;&lt;/asp:Label&gt; &lt;asp:TextBox ID="txtPassword" runat="server" TextMode="Password" &gt; &lt;/asp:TextBox&gt; &lt;asp:RegularExpressionValidator ID="valPassword" runat="server" ErrorMessage="Password must contain between 8 - 15 characters" ControlToValidate="txtpassword" ValidationExpression="[a-zA-Z'.\s]{8,15}$"&gt;&lt;/asp:RegularExpressionValidator&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;*Re-enter Password&lt;/label&gt; &lt;input type="password" name="re_password" /&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="bottom"&gt; &lt;div class="remember"&gt; &lt;input type="checkbox" /&gt; &lt;span&gt;Email me DocStore updates&lt;/span&gt; &lt;/div&gt; &lt;input type="submit" value="Register" /&gt; &lt;a href="registration.aspx" rel="login" class="linkform"&gt;You have a DocStore account already? Log in here&lt;/a&gt; &lt;a href="home.aspx"&gt;Return to DocStore HomePage&lt;/a&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;form class="login" action="registered_users.aspx" method="post" id="regusers1" &gt; &lt;h3&gt;Login&lt;/h3&gt; &lt;p&gt;&lt;strong&gt; &lt;i&gt; *Please enter your username and password in order to access your account.&lt;/i&gt;&lt;/strong&gt;&lt;/p&gt; &lt;div&gt; &lt;label&gt;Username:&lt;/label&gt; &lt;input type="text" name="username" /&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;Password: &lt;a href="registration.aspx" rel="forgot_password" class="forgot linkform"&gt;Forgot your password?&lt;/a&gt;&lt;/label&gt; &lt;input type="password" /&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div class="bottom"&gt; &lt;div class="remember"&gt;&lt;input type="checkbox" /&gt;&lt;span&gt;Keep me logged in&lt;/span&gt;&lt;/div&gt; &lt;input type="submit" value="Login"/&gt; &lt;a href="registration.aspx" rel="register" class="linkform"&gt;Don't have a DocStore account yet? Register here&lt;/a&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;form class="forgot_password" action="registered_users.aspx" method="post" id="regusers2" &gt; &lt;h3&gt;Forgot Password&lt;/h3&gt; &lt;div&gt; &lt;label&gt;Username or Email:&lt;/label&gt; &lt;input type="text" /&gt; &lt;span class="error"&gt;This is an error&lt;/span&gt; &lt;/div&gt; &lt;div class="bottom"&gt; &lt;input type="submit" value="Send reminder"/&gt; &lt;a href="registration.aspx" rel="login" class="linkform"&gt;Suddenly remebered account details?&lt;br/&gt; Log in here&lt;/a&gt; &lt;a href="registration.aspx" rel="register" class="linkform"&gt;You don't have a DocStore account yet? Register here&lt;/a&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!--/div--&gt; &lt;/form&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;!-- The JavaScript --&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { //the form wrapper (includes all forms) var $form_wrapper = ('&lt;%= #form_wrapper.ClientID) %&gt;'); //the current form is the one with class active $currentForm = $form_wrapper.children('form.active'), //the change form links $linkform = $form_wrapper.find('.linkform'); //get width and height of each form and store them for later $form_wrapper.children('form').each(function (i) { var $theForm = $(this); //solve the inline display none problem when using fadeIn fadeOut if (!$theForm.hasClass('active')) $theForm.hide(); $theForm.data({ width: $theForm.width(), height: $theForm.height() }); }); //set width and height of wrapper (same of current form) setWrapperWidth(); /* clicking a link (change form event) in the form makes the current form hide. The wrapper animates its width and height to the width and height of the new current form. After the animation, the new form is shown */ $linkform.bind('click', function (e) { var $link = $(this); var target = $link.attr('rel'); $currentForm.fadeOut(400, function () { //remove class active from current form $currentForm.removeClass('active'); //new current form $currentForm = $form_wrapper.children('form.' + target); //animate the wrapper $form_wrapper.stop() .animate({ width: $currentForm.data('width') + 'px', height: $currentForm.data('height') + 'px' }, 500, function () { //new form gets class active $currentForm.addClass('active'); //show the new form $currentForm.fadeIn(400); }); }); e.preventDefault(); }); function setWrapperWidth() { $form_wrapper.css({ width: $currentForm.data('width') + 'px', height: $currentForm.data('height') + 'px' }); } /* I need to check the which form was submited, and give the class active to the form I want to show */ $form_wrapper.find('input[type="submit"]') .click(function (e) { e.preventDefault(); }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>