Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.23 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3. function checkRadio(frmName, rbGroupName)
  4. {
  5. var radios = frmName.elements[rbGroupName];
  6. for (var i=0; i <radios.length; i++)
  7. {
  8. if (radios[i].checked)
  9. {
  10. return true;
  11. }
  12. }
  13. return false;
  14. }
  15. function chk_oauth(objForm)
  16. {
  17. var user = objForm.user.value;
  18. var pass = objForm.password.value;
  19.  
  20. if(user =="")
  21. {
  22. alert("Type email");
  23. return false;
  24. }
  25.  
  26. if(pass =="")
  27. {
  28. alert("Type pasword");
  29. return false;
  30. }
  31.  
  32. if (!checkRadio(objForm,"oauth_option"))
  33. {
  34. alert("Please select option");
  35. return false;
  36. }
  37. }
  38. </script>
  39. <form name = "frmOauth" enctype="multipart/form-data" action = "" method = "post" onsubmit="javascript:return chk_oauth(this);">
  40. <label><input type="radio" name="oauth_option" id="oauth_yes" value="Yes" onclick="toggle(this)" >Yes</label>
  41. <label><input type="radio" name="oauth_option" id="oauth_no" value="No" onclick="toggle(this)">No</label>
  42. <div class="oauth_div" id="oauth_div" >
  43. Email Address* <br />
  44. <input type="text" class="input-profile-other" placeholder="Email" id="user" name="user" />
  45. Password * <br/>
  46. <input type="password" class="input-profile-other" type="password" id="password" name="password" placeholder="password" />
  47. </div>
  48. <input class="btn-home-search1" type="submit" value="Go" name="oauth_submit" id="oauth_submit">
  49. </form>
  50.  
  51. <script type="text/javascript">
  52. var t = document.getElementById('oauth_div');
  53.  
  54. function toggle(switchElement) {
  55. if (switchElement.id == 'oauth_yes'){
  56. t.style.display = '';
  57. //email.setAttribute('type','email');
  58. t.style.visibility = 'visible';
  59. }else{
  60. t.style.display = 'none';
  61. //email.setAttribute('type','text');
  62. t.style.visibility = 'hidden';
  63. }
  64. }
  65.  
  66. [].forEach.call( document.forms.frmOauth.oauth_option, function(radio){
  67. if( radio.checked ) {
  68. toggle( radio );
  69. }
  70. });
  71. </script>
  72.  
  73. function chk_oauth(objForm)
  74. {
  75. if(document.getElementById('oauth_div').style.display=='none')
  76. return;
  77. var user = objForm.user.value;
  78. var pass = objForm.password.value;
  79.  
  80. if(user =="")
  81. {
  82. alert("Type email");
  83. return false;
  84. }
  85.  
  86. if(pass =="")
  87. {
  88. alert("Type pasword");
  89. return false;
  90. }
  91.  
  92. if (!checkRadio(objForm,"oauth_option"))
  93. {
  94. alert("Please select option");
  95. return false;
  96. }
  97. }
  98.  
  99. <form name = "frmOauth" enctype="multipart/form-data" action = "" method = "post" onsubmit="javascript:return chk_oauth(this);">
  100. <label><input type="radio" name="oauth_option" id="oauth_yes" value="Yes" onclick="toggle(this)" >Yes</label>
  101. <label><input type="radio" name="oauth_option" id="oauth_no" value="No" onclick="toggle(this)">No</label>
  102. <div class="oauth_div" id="oauth_div" >
  103. Email Address* <br />
  104. <input type="text" class="input-profile-other oauth_class" placeholder="Email" id="user" name="user" />
  105. Password * <br/>
  106. <input type="password" class="input-profile-other oauth_class" type="password" id="password" name="password" placeholder="password" />
  107. </div>
  108. <input class="btn-home-search1" type="submit" value="Go" name="oauth_submit" id="oauth_submit">
  109. </form>
  110.  
  111. var t = document.getElementById('oauth_div');
  112. function toggle(switchElement) {
  113. if (switchElement.id == 'oauth_yes'){
  114. t.style.display = '';
  115. var temp = document.getElementByClass('oauth_class');
  116. temp.style.display = ''
  117. //email.setAttribute('type','email');
  118. t.style.visibility = 'visible';
  119. }else{
  120. t.style.display = 'none';
  121. //email.setAttribute('type','text');
  122. t.style.visibility = 'hidden';
  123. t.style.visibility = 'hidden';
  124.  
  125. }
  126. }
  127.  
  128. document.getElementById("oauth_div").style.visibility == "visible"
  129.  
  130. function isVisible(elem) {
  131. var cmpstyle = window.getComputedStyle(elem,null);
  132. if (parseFloat(cmpstyle.opacity) > 0 &&
  133. cmpstyle.visibility != 'hidden' &&
  134. cmpstyle.display != 'none') {
  135. return true;
  136. } else return false;
  137. }
  138.  
  139. function chk_oauth(objForm)
  140. {
  141. var oauth_div = document.getElementById("oauth_div");
  142.  
  143. if (isVisible(oauth_div)) {
  144. var user = objForm.user.value;
  145. var pass = objForm.password.value;
  146.  
  147. if(user =="")
  148. {
  149. alert("Type email");
  150. return false;
  151. }
  152.  
  153. if(pass =="")
  154. {
  155. alert("Type pasword");
  156. return false;
  157. }
  158.  
  159. if (!checkRadio(objForm,"oauth_option"))
  160. {
  161. alert("Please select option");
  162. return false;
  163. }
  164. } else { /*Do whatever you want to happen when div is hidden*/ }
  165.  
  166.  
  167. }
  168.  
  169. function chk_oauth(objForm)
  170. {
  171. var user = objForm.user.value;
  172. var pass = objForm.password.value;
  173.  
  174. if(document.getElementById("oauth_div").style.visibility != "none"){
  175. if(user =="")
  176. {
  177. alert("Type email");
  178. return false;
  179. }
  180.  
  181. if(pass =="")
  182. {
  183. alert("Type pasword");
  184. return false;
  185. }
  186. }
  187. if (!checkRadio(objForm,"oauth_option"))
  188. {
  189. alert("Please select option");
  190. return false;
  191. }
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement