你好,我是一名學生,最近我正在學習 JavaScript、CSS 和 HTML,在做練習時我遇到了問題。在練習中,我使用 Bootstrap。function Form(stringa){ document.getElementById("form1").style.display="none"; document.getElementById("form2").style.display = "none"; document.getElementById(stringa).style.display = "block"; }<!doctype html><html> <head> <title>Form di registrazione</title> </head> <body> <div class="container"> <h1>Form di Registrazione</h1> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" value=1 onclick="Form('form1');" > <label class="form-check-label" for="inlineRadio1">Privato</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" onclick="Form('form2'); " value=2> <label class="form-check-label" for="inlineRadio2">Azienda</label> </div> <form id="form1" class="row g-3" value=1> <div class="col-md-6"> <label for="inputEmail4" class="form-label">Email</label> <input type="email" class="form-control" id="inputEmail4"> </div> <div class="col-md-6"> <label for="inputPassword4" class="form-label">Password</label> <input type="password" class="form-control" id="inputPassword4"> </div> </form> <form id="form2" type="hidden"class="row g-3"style="display:none;" value=2> <div class="col-md-6"> <label for="inputEmail4" class="form-label">Eeeeee</label> <input type="email" class="form-control" id="inputEmail4"> </div> </form> </div> </body></html>為什么當我單擊單選按鈕時它會更改表單布局?
當我單擊一個單選按鈕時更改布局形式
Cats萌萌
2024-01-18 15:56:48