开发者

asp.net change list item values with url

开发者 https://www.devze.com 2023-02-12 20:28 出处:网络
I have a tabbed list that changes the div with javascript when selected. I would like to have have other pages on my site lead to and set a list item to active.

I have a tabbed list that changes the div with javascript when selected. I would like to have have other pages on my site lead to and set a list item to active.

With the code below my content_1 list item is set to active, I would like to have the active tab changed if say I selected a content_3 link from another page and I would like to set a custom url that will set content_3 to active when i go to the page with the list. Any help appreciated, thanks.

<div class="tabbed_area">  

         <ul class="tabs">  
           <li><a href="#" title="content_1" class="tab active">Web Design</a></li>  
           <li><a href="#" title="content_2" class="tab">Web Design</a></li>  
           <li><a href="#" title="content_3" class="tab">web Design</a></li>  
           <li><a href="#" title="content_4" class="tab">Web Design</a></li> 
           <li><a href="#" title="content_5" class="tab">Web Design</a></li>
           <li><a href="#" title="content_6" class="tab">Web Design</a></li> 
        </ul>  

    <div id="content_1" class="content">
        <ul>
            <li><a href="">HTML Techniques</a></li>
            <li><a href="">CSS Styling</a></li>
            <li><a href="">Flash Tutorials</a></li>
            <li><a href="">Web Miscellanea</a></li>
            <li><a href="">Site News</a></li>
            <li><a href="">Web Development</a></li>
        </ul>
    </div>
    <div id="content_2" class="content">
        <ul>
            <li><a href="">HTML Techniques</a></li>
            <li><a href="">CSS Styling</a></li>
            <li><a href="">Flash Tutorials</a></li>
            <li><开发者_Go百科;a href="">Web Miscellanea</a></li>
            <li><a href="">Site News</a></li>
            <li><a href="">Web Development</a></li>
        </ul>
    </div>
    <div id="content_3" class="content">
        <ul>
            <li><a href="">HTML Techniques</a></li>
            <li><a href="">CSS Styling</a></li>
            <li><a href="">Flash Tutorials</a></li>
            <li><a href="">Web Miscellanea</a></li>
            <li><a href="">Site News</a></li>
            <li><a href="">Web Development</a></li>
        </ul>
    </div>
     <div id="content_4" class="content">
        <ul>
            <li><a href="">HTML Techniques</a></li>
            <li><a href="">CSS Styling</a></li>
            <li><a href="">Flash Tutorials</a></li>
            <li><a href="">Web Miscellanea</a></li>
            <li><a href="">Site News</a></li>
            <li><a href="">Web Development</a></li>
        </ul>
    </div>
    <div id="content_5" class="content">
        <ul>
            <li><a href="">HTML Techniques</a></li>
            <li><a href="">CSS Styling</a></li>
            <li><a href="">Flash Tutorials</a></li>
            <li><a href="">Web Miscellanea</a></li>
            <li><a href="">Site News</a></li>
            <li><a href="">Web Development</a></li>
        </ul>
    </div>
    <div id="content_6" class="content">
        <ul>
            <li><a href="">HTML Techniques</a></li>
            <li><a href="">CSS Styling</a></li>
            <li><a href="">Flash Tutorials</a></li>
            <li><a href="">Web Miscellanea</a></li>
            <li><a href="">Site News</a></li>
            <li><a href="">Web Development</a></li>
        </ul>
    </div>

 </div>  


If you want to do it similar to that PHP way, you can add this to the class attributes in the tab li :

<% = Request.QueryString["page"] == "about" ? "active" : "" %>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号