抱歉,我是 javascript 的新手,我在互联网的某个地方找到了这个,我写了糟糕的代码,但这在 chrome 中有效......
function toggle() {
var ele = document.getElementById("toggleText");
var text = document.getElementById("displayText");
if(ele.style.display == "block") {
ele.style.display = "none";
$(".class").nariams();
}
else {
ele.style.display = "block";
$(".class").nariams();
}
}
<div class "nariams1"><a id="displayText" href="javascript:toggle();">
<div class="nariams">Nariams </div>
</div>
<div id="toggleText" style="display: none">
<form id="slick-login">
<label for="username">Prisijungimo vardas</label><input type="text" name="username" class="placeholder" placeholder="vardas">
<label for="password">Slaptažodis</label><input type="password" name="password" class="placeholder" placeholder="slaptažodis">
<input type="submit" value="Prisijungti">
</form>
</div>
.nariams 是定义按钮的 css 类。不久,当我按下其他班级的按钮时,我想要那个。此代码适用于 chrome。