Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在导航选项卡上显示不同的div单击,刷新内容,默认选择选项卡_Jquery_Css_Asp.net - Fatal编程技术网

Jquery 在导航选项卡上显示不同的div单击,刷新内容,默认选择选项卡

Jquery 在导航选项卡上显示不同的div单击,刷新内容,默认选择选项卡,jquery,css,asp.net,Jquery,Css,Asp.net,我不熟悉asp和css的概念,这里我遇到了一个非常基本的问题 我有一个导航栏 我的划分如下 <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <div id = "TextBox"> //a text box here which is common and should be displayed with both the sections below </div> <div id ="D

我不熟悉asp和css的概念,这里我遇到了一个非常基本的问题

我有一个导航栏

我的划分如下

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<div id = "TextBox">
    //a text box here which is common and should be displayed with both the sections below
</div>

<div id ="Div1" class= "section">
 // some button and text boxes here
</div>

<div id ="Div2" class= "section">
 // some button and text boxes here
</div>
</updatePanle>
css文件节定义有助于正确选择分区,但当页面加载时,只显示顶部文本框div

因此,我需要在页面加载时默认显示div1内容,而且当textbox div中的textbox由一个值填充时,内容会刷新,页面上也没有div1或div2内容

div在更新面板中定义


提前感谢您的帮助。

使用javascript似乎是唯一的解决方案。 在一个非常相似的例子中提到了一个解决方案

根据您的用例调整后的解决方案是

if (document.location.hash == "" || document.location.hash == "#")
    document.location.hash = "#Div1";

好的,谢谢,有点效果,但不完全。页面加载Div的艺术部分被显示,但当我从导航栏中选择Div2时,它首先显示div1的一部分,然后显示在Div2的底部。如果document.location.hash==| | document.location.hash==document.location.hash=Div1;css文件:.tab、.tab:target~Div1{display:none;}Div1、.tab:target{display:block;.tab、.tab:target~Div2{display:none;}Div2、.tab:target{display:block;}在选择Div2时,公用文本框不可见
if (document.location.hash == "" || document.location.hash == "#")
    document.location.hash = "#Div1";