Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.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
Javascript 使用textEditor隐藏/显示文本区域取决于下拉列表值_Javascript_Jquery_Drop Down Menu_Jquery Selectors - Fatal编程技术网

Javascript 使用textEditor隐藏/显示文本区域取决于下拉列表值

Javascript 使用textEditor隐藏/显示文本区域取决于下拉列表值,javascript,jquery,drop-down-menu,jquery-selectors,Javascript,Jquery,Drop Down Menu,Jquery Selectors,我在正在工作的文本区域使用NicEdit(www.NicEdit.com)文本编辑器,在下拉列表中选择一个值后,下面的代码隐藏和显示文本区域,它将显示文本区域,但这是我需要帮助的地方 1) 我希望在您从下拉列表中选择任何值之前显示文本区域 2) 在从下拉列表中选择一个值以显示文本区域后,我希望文本编辑器(NicEdit)在所有文本区域上显示 用于文本编辑器(Nicedit)的Js: bkLib.ondomload(函数(){ 新的nicEditor({maxHeight:200}).panel

我在正在工作的文本区域使用NicEdit(www.NicEdit.com)文本编辑器,在下拉列表中选择一个值后,下面的代码隐藏和显示文本区域,它将显示文本区域,但这是我需要帮助的地方

1) 我希望在您从下拉列表中选择任何值之前显示文本区域

2) 在从下拉列表中选择一个值以显示文本区域后,我希望文本编辑器(NicEdit)在所有文本区域上显示

用于文本编辑器(Nicedit)的Js:


bkLib.ondomload(函数(){
新的nicEditor({maxHeight:200}).panelInstance('area');
});
要隐藏和显示文本区域,请执行以下操作:

   <script type="text/javascript">
        function showHide() 
        {
            if(document.getElementById("color_dropdown").selectedIndex == 1) 
            {
                document.getElementById("hidden1").style.display = ""; // This line makes the DIV visible
            } 
            else {            
                document.getElementById("hidden1").style.display = "none"; // This line hides the DIV
            }

            if(document.getElementById("color_dropdown").selectedIndex == 2) 
            {
                document.getElementById("hidden2").style.display = ""; // This line makes the DIV visible
            } 
            else {            
                document.getElementById("hidden2").style.display = "none"; // This line hides the DIV
            }

            if(document.getElementById("color_dropdown").selectedIndex == 3) 
            {
                document.getElementById("hidden3").style.display = ""; // This line makes the DIV visible
            } 
            else {            
                document.getElementById("hidden3").style.display = "none"; // This line hides the DIV
            }
        }
    </script>

函数showHide()
{
if(document.getElementById(“color_下拉列表”).selectedIndex==1)
{
document.getElementById(“hidden1”).style.display=“”;//此行使DIV可见
} 
否则{
document.getElementById(“hidden1”).style.display=“none”;//此行隐藏DIV
}
if(document.getElementById(“color_下拉列表”).selectedIndex==2)
{
document.getElementById(“hidden2”).style.display=“”;//此行使DIV可见
} 
否则{
document.getElementById(“hidden2”).style.display=“none”;//此行隐藏DIV
}
if(document.getElementById(“color_下拉列表”).selectedIndex==3)
{
document.getElementById(“hidden3”).style.display=“”;//此行使DIV可见
} 
否则{
document.getElementById(“hidden3”).style.display=“none”;//此行隐藏DIV
}
}
Html下拉列表:

<select name="menu"  id="color_dropdown" onchange="showHide()"> 
<option>Select Meun</option>
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>   

    <textarea id="hidden1" name="area" display:none;"   id="area">ggggggggggggggggg</textarea>
    <textarea id="hidden2" name="area"  display:none;" id="area">hhhhhhhhhhhhhhhhh</textarea>
    <textarea id="hidden3" name="area"  display:none;"  id="area">yyyyyyyyyyyyyyyyy</textarea>

选择Meun
一个
两个
三
HHHHHHHHHHHHHHHHHHHHHHHHH

只是一个小提示,您有更多的id,每个文本区域有多个id属性,第二个id具有相同的值,这应该是一个类。文本区域中的“display:none;”不在样式标记(style=“display:none;”)中,还可以尝试在html页面底部最后一个html标记(或最后一个body标记)之前链接/加载javascript

我不确定这是否能解决您的问题,但这些可能是问题

<select name="menu"  id="color_dropdown" onchange="showHide()"> 
<option>Select Meun</option>
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>   

    <textarea id="hidden1" name="area" display:none;"   id="area">ggggggggggggggggg</textarea>
    <textarea id="hidden2" name="area"  display:none;" id="area">hhhhhhhhhhhhhhhhh</textarea>
    <textarea id="hidden3" name="area"  display:none;"  id="area">yyyyyyyyyyyyyyyyy</textarea>