Advertisement
1xptolevitico69

Toggle between Radio buttons

Sep 26th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.17 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang=en>
  3. <head>
  4. <title></title>
  5. <meta charset=utf-8>
  6. <meta name="viewport" content="width=device-width">
  7. <style>
  8.  
  9. input {
  10. transform:scale(2);
  11. margin:20px 20px;
  12. }
  13.  
  14. a {
  15. font-size:30px;
  16. font-family:courier new;
  17. font-weight:900;
  18. text-decoration:none;
  19. }
  20.  
  21. </style>
  22. </head>
  23. <body>
  24.  
  25. <input id='html_input' onclick='html()'  type="radio" name="web"/>
  26. <a href='#' onclick='foo_html()' target='_self'>Html</a><br/>
  27.  
  28. <input id='css_input' onclick='css()'  type="radio" name="web"/>
  29. <a href='#' onclick='foo_css()' target='_self'>Css</a><br/>
  30.  
  31. <input id='script_input' onclick='script()'  type="radio" name="web"/>
  32. <a href='#' onclick='foo_script()' target='_self'>JavaScript</a>
  33.  
  34.  
  35. <script>
  36. i=0;
  37.  
  38. function html(){
  39. i=1;
  40. }
  41. function foo_html(){
  42. if(i==1){
  43. html_input.name='';
  44. location.href='https://www.w3schools.com/html/';
  45. }
  46. }
  47.  
  48. function css(){
  49. i=2;
  50. }
  51. function foo_css(){
  52. if(i==2){
  53. css_input.name='';
  54. location.href='https://www.w3schools.com/css/';
  55. }
  56. }
  57.  
  58. function script(){
  59. i=3;
  60. }
  61. function foo_script(){
  62. if(i==3){
  63. script_input.name='';
  64. location.href='https://www.w3schools.com/js/';
  65. }
  66. }
  67.  
  68.  
  69. </script>
  70. </body>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement