简体   繁体   中英

Display Hidden Tbody Content with OnClick/A Href Tag

I have various hidden tables that become displayed with onChange events. In the content of one of these tables, I would like to put a hyperlink that will take me back to the previously hidden table. So, to begin with, I have:

<table>
<tbody id="option11" style="display: none;">
<tr>
    <td>
        <p>
        <select name="type" onChange="display(this,'option11a','option11b');">
        <option>Please select:</option>
        <option value= "option11a">Missed Deadline</option>
        <option value= "option11b">Application Down</option>
        </select>
        </p>
    </td>
</tr>
</table>

The onChange associated with this table is:

 function display(obj,id11a,id11b) 
{
    txt = obj.options[obj.selectedIndex].value;
    document.getElementById(id11a).style.display = 'none';
    document.getElementById(id11b).style.display = 'none';  

    if ( txt.match(id11a) ) 
        {
        document.getElementById(id11a).style.display = 'block';
        }
    if ( txt.match(id11b) ) 
        {
        document.getElementById(id11b).style.display = 'block';
        }
}

If the user selects option11a, they are presented with:

<table>
<tbody id="option11a" style="display: none;">
<tr>
    <tr>
        <td><p>1.  Identify missing work.</p></td>
        <td><p>2.  Contact management.</p></td>
    </tr> 
</tr>

And, if the user selects option11b, they are presented with:

<table>
<tbody id="option11b" style="display: none;">
<tr>
    <tr>
        <td><p>1.  Contact management.</p></td>
        <td><p>2.  Refer to Missed Deadline instructions.</p></td>
    </tr> 
</tr>

So- what I'd like to do is this: Place a hyperlink of some sort in the "Refer to Missed Deadline instructions" that, when clicked, displays the table with tbody id option11a once again.

Let me know if I should better clarify. Greatly appreciate all help! Thanks.

You can do this easily with jquery's .last selector.

http://api.jquery.com/last-selector/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM