Onclik change text in anchor and enable div which has form fields and hide onload default property


/ Published in: JavaScript
Save to your folder(s)

Onclik change text in anchor and enable div which has form fields and hide onload default property


Copy this code and paste it in your HTML
  1. <!--By Shashikanth reddy nalabolu - PHP Developer-->
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  6. <title>Untitled Document</title>
  7. <script language="javascript">
  8.  
  9. function status1()
  10. {
  11.  
  12. if(document.getElementById("hchk").value=="0"){
  13. //alert("if");
  14.  
  15. document.getElementById("r1").innerHTML="Basic";
  16. document.getElementById("hchk").value="1";
  17. var div1=document.getElementById("login1");
  18. div1.style.display="none";
  19. var div2=document.getElementById("new_acc");
  20. div2.style.display="block";
  21.  
  22. }else{
  23. //alert("else");
  24.  
  25. document.getElementById("r1").innerHTML="Advance";
  26. document.getElementById("hchk").value="0";
  27. var div2=document.getElementById("new_acc");
  28. div2.style.display="none";
  29. var div1=document.getElementById("login1");
  30. div1.style.display="block";
  31. }
  32.  
  33. }
  34. function start_up()
  35. {
  36. var div2=document.getElementById("new_acc");
  37. document.getElementById("hchk").value="0";
  38. div2.style.display="none";
  39. }
  40. </script>
  41. </head>
  42.  
  43. <body onLoad="start_up()">
  44. <table id="Table_01" width="464" height="431" border="0" cellpadding="0" cellspacing="0">
  45.  
  46. <tr>
  47. <td align="right" valign="top"></td>
  48.  
  49. <td align="left" valign="top" background="images/centertabbgb.GIF">
  50.  
  51. <table width="100%">
  52. <tr>
  53. <td valign="top" align="right"><a href="#" name="r1" onClick="javascript:status1()" id="r1">Advance</a><br />
  54. <input type="hidden" name="hchk" id="hchk" value="0" />
  55. </td>
  56. </tr>
  57. <tr>
  58.  
  59. <td valign="top">
  60.  
  61. <form name="frmLogin" action="" method="post" onSubmit="return validate_login()">
  62.  
  63. <div id="login1">
  64. <table width="100%" border="0" cellspacing="1" cellpadding="1">
  65. <tr>
  66. <tD><font face="Verdana"><small>Login Form</small></font><br /><br /></tD>
  67. </tr>
  68. <tr>
  69.  
  70. <td width="49%"><font face="Verdana"><small>Enter the E-mail Address </small></font></td>
  71. <td width="2%">:</td>
  72. <td width="49%"><input name="userid" type="text" id="userid"></td>
  73. </tr>
  74. <tr>
  75. <td><font face="Verdana"><small>Password </small></font></td>
  76. <td>:</td>
  77.  
  78. <td><input name="password" type="password" id="password"></td>
  79. </tr>
  80.  
  81. <tr align="center">
  82. <td colspan="3" valign="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  83. <input type="submit" name="Submit3" value="Submit" />
  84. &nbsp;
  85. <input type="reset" name="Reset" value="Clear"/></td></tr>
  86. <tr align="center">
  87.  
  88. <td colspan="3" valign="top"></td>
  89. </tr>
  90. </table>
  91. </div>
  92. </form>
  93.  
  94.  
  95. </td>
  96. </tr>
  97.  
  98. <tr>
  99. <td valign="top">
  100.  
  101. <form method="post" name="frmEnquiry" onsubmit="return Validate();">
  102. <input type="hidden" name="regis" value="1">
  103. <div id="new_acc">
  104. <table width="119%" border="0" align="center" cellpadding="3" cellspacing="1">
  105. <tr bgcolor="#FEFBE0">
  106. <td width="46%" bgcolor="#FFFFFF"><font face="Verdana"><small>First Name</small></font></td>
  107. <td width="54%" bgcolor="#FFFFFF"><input id="text1" name="fbName" class="textbox" size="30"/></td>
  108. </tr>
  109.  
  110. <tr align="left" valign="top">
  111. <td width="46%"><font face="Verdana"><small>Last Name</small></font></td>
  112. <td width="54%"><input id="text1" name="lbName" class="textbox" size="30"/> </td>
  113. </tr>
  114. <tr align="left" valign="top">
  115. <td><font face="verdana"><small> Email ID</small></font></td>
  116. <td><input id="text6" name="bEmail"
  117. class="textbox" size="30"/> </td>
  118.  
  119. </tr>
  120. <tr align="left" valign="top">
  121. <td width="46%"><font face="Verdana"><small>Password</small></font></td>
  122. <td width="54%"><input name="pwd" type="password" class="textbox" id="text1" size="30"/> </td>
  123. </tr>
  124. <tr align="left" valign="top">
  125.  
  126. </tr>
  127.  
  128.  
  129. <tr>
  130. <td>&nbsp;</td>
  131. <td><input name="Submit" type="submit" value="Register" />
  132. &nbsp;&nbsp;
  133. <input type="reset" name="Submit2" value="Cancel" /></td>
  134. </tr>
  135.  
  136. </table>
  137. </div>
  138. </form>
  139. </td>
  140.  
  141. </tr>
  142. </table>
  143. <p class="textblack"></td>
  144. <td valign="top">&nbsp;</td>
  145. </tr>
  146. <tr>
  147. <td>&nbsp;</td>
  148. <td>&nbsp;</td>
  149. <td>&nbsp;</td>
  150.  
  151. </tr>
  152. </table>
  153. </body>
  154. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.