admin管理员组

文章数量:1025476

i am developing i website using master page this master page doesn't has any menus but i want to create a javascript menu for one of the content page and this page will navigate to other pages the will have the same menu always appeared there.

i am using c# and asp so how to do that and make this menu also fixed among all selected items (and see which one selected by some css) .

i hope that i described well what i need because i am so confused so sorry for that.

i am developing i website using master page this master page doesn't has any menus but i want to create a javascript menu for one of the content page and this page will navigate to other pages the will have the same menu always appeared there.

i am using c# and asp so how to do that and make this menu also fixed among all selected items (and see which one selected by some css) .

i hope that i described well what i need because i am so confused so sorry for that.

Share Improve this question edited Dec 9, 2012 at 8:34 Peter Kiss 9,3292 gold badges25 silver badges38 bronze badges asked Dec 9, 2012 at 8:23 special lifespecial life 2251 gold badge7 silver badges20 bronze badges 7
  • I'm sorry, I don't really understand your question... – 11684 Commented Dec 9, 2012 at 8:25
  • sorry for that look i need a menu that will appear only in one of the content page i mean this content page will take the style of the master page +new menu that will appear only there (we can consider at this time this content page as another master page) is it clear now or what? – special life Commented Dec 9, 2012 at 8:28
  • As far as I can understand you want to have a dropdown menu listing all your pages, and if the user click on it, her/his browser should navigate to that page. Is that correct? – 11684 Commented Dec 9, 2012 at 8:32
  • yeah correct but i mean i want this menu appear in all pages – special life Commented Dec 9, 2012 at 8:38
  • put the code in the master page – jjj Commented Dec 9, 2012 at 8:39
 |  Show 2 more ments

1 Answer 1

Reset to default 3

You don't need JS for this. There are many solution for this you just did not used the right keywords. Try search for: horizontal drop down menu css

The first step is to create a nested ul-li-ul-li structure:

<ul id="coolMenu">
    <li><a href="#">Lorem</a></li>
    <li><a href="#">Mauricii</a></li>
    <li>
        <a href="#">Periher</a>
        <ul>
            <li><a href="#">Hellenico</a></li>
            <li><a href="#">Genere</a></li>
            <li><a href="#">Indulgentia</a></li>
        </ul>
    </li>
    <li><a href="#">Tyrio</a></li>
    <li><a href="#">Quicumque</a></li>
</ul>

Then apply a few CSS rules.

#coolMenu,
#coolMenu ul {
    list-style: none;
}
#coolMenu {
    float: left;
}
#coolMenu > li {
    float: left;
}
#coolMenu li a {
display: block;
    height: 2em;
    line-height: 2em;
    padding: 0 1.5em;
    text-decoration: none;
}
#coolMenu ul {
    position: absolute;
    display: none;
z-index: 999;
}
#coolMenu ul li a {
    width: 80px;
}
#coolMenu li:hover ul {
    display: block;
}

Further code: http://www.cssnewbie./horizontal-dropdown-menus/

Other solution: http://matthewjamestaylor./blog/centered-dropdown-menus

i am developing i website using master page this master page doesn't has any menus but i want to create a javascript menu for one of the content page and this page will navigate to other pages the will have the same menu always appeared there.

i am using c# and asp so how to do that and make this menu also fixed among all selected items (and see which one selected by some css) .

i hope that i described well what i need because i am so confused so sorry for that.

i am developing i website using master page this master page doesn't has any menus but i want to create a javascript menu for one of the content page and this page will navigate to other pages the will have the same menu always appeared there.

i am using c# and asp so how to do that and make this menu also fixed among all selected items (and see which one selected by some css) .

i hope that i described well what i need because i am so confused so sorry for that.

Share Improve this question edited Dec 9, 2012 at 8:34 Peter Kiss 9,3292 gold badges25 silver badges38 bronze badges asked Dec 9, 2012 at 8:23 special lifespecial life 2251 gold badge7 silver badges20 bronze badges 7
  • I'm sorry, I don't really understand your question... – 11684 Commented Dec 9, 2012 at 8:25
  • sorry for that look i need a menu that will appear only in one of the content page i mean this content page will take the style of the master page +new menu that will appear only there (we can consider at this time this content page as another master page) is it clear now or what? – special life Commented Dec 9, 2012 at 8:28
  • As far as I can understand you want to have a dropdown menu listing all your pages, and if the user click on it, her/his browser should navigate to that page. Is that correct? – 11684 Commented Dec 9, 2012 at 8:32
  • yeah correct but i mean i want this menu appear in all pages – special life Commented Dec 9, 2012 at 8:38
  • put the code in the master page – jjj Commented Dec 9, 2012 at 8:39
 |  Show 2 more ments

1 Answer 1

Reset to default 3

You don't need JS for this. There are many solution for this you just did not used the right keywords. Try search for: horizontal drop down menu css

The first step is to create a nested ul-li-ul-li structure:

<ul id="coolMenu">
    <li><a href="#">Lorem</a></li>
    <li><a href="#">Mauricii</a></li>
    <li>
        <a href="#">Periher</a>
        <ul>
            <li><a href="#">Hellenico</a></li>
            <li><a href="#">Genere</a></li>
            <li><a href="#">Indulgentia</a></li>
        </ul>
    </li>
    <li><a href="#">Tyrio</a></li>
    <li><a href="#">Quicumque</a></li>
</ul>

Then apply a few CSS rules.

#coolMenu,
#coolMenu ul {
    list-style: none;
}
#coolMenu {
    float: left;
}
#coolMenu > li {
    float: left;
}
#coolMenu li a {
display: block;
    height: 2em;
    line-height: 2em;
    padding: 0 1.5em;
    text-decoration: none;
}
#coolMenu ul {
    position: absolute;
    display: none;
z-index: 999;
}
#coolMenu ul li a {
    width: 80px;
}
#coolMenu li:hover ul {
    display: block;
}

Further code: http://www.cssnewbie./horizontal-dropdown-menus/

Other solution: http://matthewjamestaylor./blog/centered-dropdown-menus

本文标签: chow to create horizontal dropdown menu with javascript for aspnet websiteStack Overflow