gpt4 book ai didi

jQuery 隐藏和显示面板

转载 作者:太空宇宙 更新时间:2023-11-04 00:17:07 26 4
gpt4 key购买 nike

在下面的代码中,我试图构建两个面板;新订单面板和跟踪订单面板。我面临的问题是在第一个面板中打开的两个面板的组件。我不确定你是否理解这个问题。这是代码,您可以尝试清楚地理解它:

<html>
<head>
<script type="text/javascript" src="jscss/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){
$(".panel").slideToggle("slow");
});
});
$(document).ready(function(){
$(".flip1").click(function(){
$(".panel1").slideToggle("slow");
});
});
</script>

<style type="text/css">
div.panel,p.flip
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
height:220px;
display:none;
}
div.panel1,p.flip1
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel1
{
height:220px;
display:none;
}
</style>
</head>

<body>

<div class="panel">
<form action="Order.php" method="post">
Name<br /><input style="font-weight: bold;" name="name" size="60" type="text" AUTOCOMPLETE=OFF><br /><br />

Subject<br /><input style="font-weight: bold;" name="subject" size="60" type="text" id="subject"><br /> <br />

Email<br /><input style="font-weight: bold;" name="email" size="60" type="text"><br /> <br />

<input type="submit" value="submit" />
</form>
</div>


<div class="panel1">
<form action="Track.php" method="post">
ID<br /><input style="font-weight: bold;" name="id" size="60" type="text" AUTOCOMPLETE=OFF><br /><br />
<input type="submit" value="submit" />
</form>
</div>

<p class="flip">New Order</p>
<br/><br/><br/>
<p class="flip1">Track Order</p>

</body>
</html>

谢谢

最佳答案

那是因为你的html代码顺序错误,试试这个:

<body>

<div class="panel">
<form action="Order.php" method="post">
Name<br /><input style="font-weight: bold;" name="name" size="60" type="text" AUTOCOMPLETE=OFF><br /><br />

Subject<br /><input style="font-weight: bold;" name="subject" size="60" type="text" id="subject"><br /> <br />

Email<br /><input style="font-weight: bold;" name="email" size="60" type="text"><br /> <br />

<input type="submit" value="submit" />
</form>
</div>
<p class="flip">New Order</p>
<br/><br/><br/>

<div class="panel1">
<form action="Track.php" method="post">
ID<br /><input style="font-weight: bold;" name="id" size="60" type="text" AUTOCOMPLETE=OFF><br /><br />
<input type="submit" value="submit" />
</form>
</div>
<p class="flip1">Track Order</p>

关于jQuery 隐藏和显示面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10791888/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com