HTML和Javascript根据所选的单选按钮显示不同的小部件

huangapple go评论68阅读模式
英文:

HTML and Javascript to Display Different Widget Depending on Selected Radio Button

问题

Upon selecting radio buttons, users should see different content, but it is not working for some reason. I wrapped the display in question under div tag, but its not returning what its supposed to return. Below is the code snippet for the problem that was mentioned.

function displayPersonOrCompanySearchFields(personSearchAreaId='person-search-states', companySearchAreaId='company-search-states') {
    const personSearchField = document.getElementById('person-search-field');
    const companySearchField = document.getElementById('company-search-field');

    const personSearchArea = document.getElementById(personSearchAreaId);
    const companySearchArea = document.getElementById(companySearchAreaId);

    const personSearchOtherSources = document.getElementById('person-search-other-sources');
    const companySearchOtherSources = document.getElementById('company-search-other-sources');

    const subjectType = getSubjectType();

    if (subjectType === 'person-subject') {
        personSearchArea.style.display = 'block';
        if (personSearchOtherSources) personSearchOtherSources.style.display = 'block';
        personSearchField.style.display = 'block';

        companySearchArea.style.display = 'none';
        if (companySearchOtherSources) companySearchOtherSources.style.display = 'none';
        companySearchField.style.display = 'none';
    } else if (subjectType === 'company-subject') {
        companySearchArea.style.display = 'block';
        if (companySearchOtherSources) companySearchOtherSources.style.display = 'block';
        companySearchField.style.display = 'block';

        personSearchArea.style.display = 'none';
        if (personSearchOtherSources) personSearchOtherSources.style.display = 'none';
        personSearchField.style.display = 'none';
    }
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="canada.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script defer src="/canada.js"></script>
    <title>MESA Canada</title>
</head>
<body>
    <div class="container">
        <p class="title">MESA Canada</p>
    </div>
    <div id="company-search-field">
        <input style="background-color: white; margin-left: 1rem; width: 300px; line-height: 5;" placeholder="Insert company name here">
        </input>
    </div>
    <div id="person-search-field" style="display: none;">
        <input style="background-color: white; margin-left: 1rem; width: 300px; line-height: 5;" placeholder="Insert person name here">
        </input>
    </div>
    <br></br>
    <div class="search-subject" style="margin-left: 1rem;">
        <input type="radio" onclick="displayPersonOrCompanySearchFields(); resetSearchFields()" id="person-subject" name="subject-type" value="person-subject" checked>
        <label for="person-subject">Company</label>
        <input type="radio" onclick="displayPersonOrCompanySearchFields(); resetSearchFields()" id="company-subject" name="subject-type" value="company-subject">
        <label for="company-subject">Person</label>
    </div>
    <br></br>
    <!-- WHEN COMPANY IS SELECTED -->
    <div class="subject-name-search">
        <div id="subject-search-form">
            <div id="company-search-states">
                <div class="states-dropdown-list">
                    <form action="" onsubmit="return false;" style="width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;">
                        <b style="margin-left: 1rem;"><span style="color: darkgreen;">Corporate Records</span> and <span style="color: darkgreen;">Litigation</span> Research</b>
                        <div style="border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 26rem; background-color: black;">
                            <svg style="color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.

<details>
<summary>英文:</summary>

Upon selecting radio buttons, users should see different content, but it is not working for some reason. I wrapped the display in question under div tag, but its not returning what its supposed to return. Below is the code snippet for the problem that was mentioned.

&lt;!-- begin snippet: js hide: false console: true babel: false --&gt;

&lt;!-- language: lang-js --&gt;

    function displayPersonOrCompanySearchFields(personSearchAreaId=&#39;person-search-states&#39;, companySearchAreaId=&#39;company-search-states&#39;) {
        const personSearchField = document.getElementById(&#39;person-search-field&#39;);
        const companySearchField = document.getElementById(&#39;company-search-field&#39;);

        const personSearchArea = document.getElementById(personSearchAreaId);
        const companySearchArea = document.getElementById(companySearchAreaId);

        const personSearchOtherSources = document.getElementById(&#39;person-search-other-sources&#39;);
        const companySearchOtherSources = document.getElementById(&#39;company-search-other-sources&#39;);

        const subjectType = getSubjectType();

        if (subjectType === &#39;person-subject&#39;) {
            personSearchArea.style.display = &#39;block&#39;;
            if (personSearchOtherSources) personSearchOtherSources.style.display = &#39;block&#39;;
            personSearchField.style.display = &#39;block&#39;;

            companySearchArea.style.display = &#39;none&#39;;
            if (companySearchOtherSources) companySearchOtherSources.style.display = &#39;none&#39;;
            companySearchField.style.display = &#39;none&#39;;
        } else if (subjectType === &#39;company-subject&#39;) {
            companySearchArea.style.display = &#39;block&#39;;
            if (companySearchOtherSources) companySearchOtherSources.style.display = &#39;block&#39;;
            companySearchField.style.display = &#39;block&#39;;

            personSearchArea.style.display = &#39;none&#39;;
            if (personSearchOtherSources) personSearchOtherSources.style.display = &#39;none&#39;;
            personSearchField.style.display = &#39;none&#39;;
        }
    }

&lt;!-- language: lang-html --&gt;

    &lt;!DOCTYPE html&gt;
    &lt;html lang=&quot;en&quot;&gt;
        &lt;head&gt;
            &lt;meta charset=&quot;UTF-8&quot;&gt;
            &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
            &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
            &lt;link rel=&quot;stylesheet&quot; href=&quot;canada.css&quot;&gt; 
            &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js&quot;&gt;&lt;/script&gt;
            &lt;script defer src=&quot;/canada.js&quot;&gt;&lt;/script&gt;
            &lt;title&gt;MESA Canada&lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;
            &lt;div class=&quot;container&quot;&gt;
                &lt;p class=&quot;title&quot;&gt;MESA Canada&lt;/p&gt;
            &lt;/div&gt;
            &lt;div id=&quot;company-search-field&quot;&gt;
            &lt;input style=&quot;background-color: white; margin-left: 1rem; width: 300px; line-height: 5;&quot; placeholder=&quot;Insert company name here&quot;&gt;
            &lt;/input&gt;
            &lt;/div&gt;
            &lt;div id=&quot;person-search-field&quot; style=&quot;display: none;&quot;&gt;
            &lt;input style=&quot;background-color: white; margin-left: 1rem; width: 300px; line-height: 5;&quot; placeholder=&quot;Insert person name here&quot;&gt;
            &lt;/input&gt;
            &lt;/div&gt;
            &lt;br&gt;&lt;/br&gt;
            &lt;div class=&quot;search-subject&quot; style=&quot;margin-left: 1rem;&quot;&gt;
                &lt;input type=&quot;radio&quot; onclick=&quot;displayPersonOrCompanySearchFields(); resetSearchFields()&quot; id=&quot;person-subject&quot; name=&quot;subject-type&quot; value=&quot;person-subject&quot; checked&gt;
                &lt;label for=&quot;person-subject&quot;&gt;Company&lt;/label&gt;
                &lt;input type=&quot;radio&quot; onclick=&quot;displayPersonOrCompanySearchFields(); resetSearchFields()&quot; id=&quot;company-subject&quot; name=&quot;subject-type&quot; value=&quot;company-subject&quot;&gt;
                &lt;label for=&quot;company-subject&quot;&gt;Person&lt;/label&gt;
            &lt;/div&gt;
            &lt;br&gt;&lt;/br&gt;
            &lt;!-- WHEN COMPANY IS SELECTED --&gt;
            &lt;div class=&quot;subject-name-search&quot;&gt;
            &lt;div id=&quot;subject-search-form&quot;&gt;
            &lt;div id=&quot;company-search-states&quot;&gt;
            &lt;div class=&quot;states-dropdown-list&quot;&gt;
            &lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;&quot;&gt;
                &lt;b style=&quot;margin-left: 1rem;&quot;&gt;&lt;span style=&quot;color: darkgreen;&quot;&gt;Corporate Records&lt;/span&gt; and &lt;span style=&quot;color: darkgreen;&quot;&gt;Litigation&lt;/span&gt; Research&lt;/b&gt;
                &lt;div style=&quot;border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 26rem; background-color: black;&quot;&gt;
                    &lt;svg style=&quot;color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; class=&quot;bi bi-geo&quot; viewBox=&quot;0 0 16 16&quot;&gt; &lt;path fill-rule=&quot;evenodd&quot; d=&quot;M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z&quot; fill=&quot;white&quot;&gt;&lt;/path&gt; 
                    &lt;/svg&gt;
                &lt;/div&gt;
                &lt;ul class=&quot;states-dropdown&quot; style=&quot;list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;&quot;&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot; checked&gt;Federal Level&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot;&gt;Alberta&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;jakarta&quot;&gt;British Columbia&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;aceh&quot;&gt;Manitoba&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bali&quot;&gt;New Brunswick&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bangka-belitung&quot;&gt;Newfoundland and Labrador&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;banten&quot;&gt;Nova Scotia&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bengkulu&quot;&gt;Ontario&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-java1&quot;&gt;Prince Edward Island&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-java2&quot;&gt;Quebec&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-kalimantan&quot;&gt;Saskatchewan&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-papua&quot;&gt;Northwest Territories&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-sulawesi&quot;&gt;Nunavut&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;east-java1&quot;&gt;Yukon&lt;/label&gt;&lt;/li&gt;
                &lt;/ul&gt;
                &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;*OpenCorporates will open&lt;/span&gt;
                &lt;br&gt;
                &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;**Canada&#39;s Business Registries will open&lt;/span&gt;
                &lt;br&gt;&lt;/br&gt;
                &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                        &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Corporate Records&lt;/button&gt;
                &lt;br&gt;&lt;/br&gt;
                &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                        &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Litigation Cases&lt;/button&gt;
            &lt;/form&gt;
            &lt;/div&gt;
            &lt;!-- WHEN PERSON IS SELECTED --&gt;
            &lt;div id=&quot;person-search-states&quot; style=&quot;display: none;&quot;&gt;
            &lt;div class=&quot;states-dropdown-list&quot;&gt;
            &lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen; display: none;&quot;&gt;
                &lt;b style=&quot;margin-left: 1rem;&quot;&gt;&lt;span style=&quot;color: darkgreen;&quot;&gt;Corporate Affiliations&lt;/span&gt; and &lt;span style=&quot;color: darkgreen;&quot;&gt;Litigation&lt;/span&gt; Research&lt;/b&gt;
                &lt;div style=&quot;border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 28rem; background-color: black;&quot;&gt;
                    &lt;svg style=&quot;color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; class=&quot;bi bi-geo&quot; viewBox=&quot;0 0 16 16&quot;&gt; &lt;path fill-rule=&quot;evenodd&quot; d=&quot;M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z&quot; fill=&quot;white&quot;&gt;&lt;/path&gt; 
                    &lt;/svg&gt;
                &lt;/div&gt;
                &lt;ul class=&quot;states-dropdown&quot; id=&quot;provinces-list&quot; style=&quot;list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;&quot;&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot; checked&gt;Federal Level&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot;&gt;Alberta&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;jakarta&quot;&gt;British Columbia&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;aceh&quot;&gt;Manitoba&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bali&quot;&gt;New Brunswick&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bangka-belitung&quot;&gt;Newfoundland and Labrador&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;banten&quot;&gt;Nova Scotia&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bengkulu&quot;&gt;Ontario&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-java1&quot;&gt;Prince Edward Island&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-java2&quot;&gt;Quebec&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-kalimantan&quot;&gt;Saskatchewan&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-papua&quot;&gt;Northwest Territories&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-sulawesi&quot;&gt;Nunavut&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;east-java1&quot;&gt;Yukon&lt;/label&gt;&lt;/li&gt;
                &lt;/ul&gt;
                &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;*OpenCorporates will open&lt;/span&gt;
                &lt;br&gt;
                &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;**Canada&#39;s Business Registries will open&lt;/span&gt;
                &lt;br&gt;&lt;/br&gt;
                &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                        &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Corporate Records&lt;/button&gt;
                &lt;br&gt;&lt;/br&gt;
                &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                        &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Litigation Cases&lt;/button&gt;
            &lt;/form&gt;
            &lt;/div&gt;
            &lt;/div&gt;
            &lt;/div&gt;
            &lt;/div&gt;
            &lt;/div&gt;
        &lt;/body&gt;
    &lt;/html&gt;

&lt;!-- end snippet --&gt;

Is there a way to render what is supposed to be displayed upon radio button selection?

</details>


# 答案1
**得分**: 1

你的代码难以阅读,且存在很多错误。

首先,看一下你这里有什么。
```html
&lt;input type=&quot;radio&quot; onclick=&quot;displayPersonOrCompanySearchFields(); resetSearchFields()&quot; id=&quot;person-subject&quot; name=&quot;subject-type&quot; value=&quot;person-subject&quot; checked&gt;

labelCompany 但详情(id, value) 是 Person (反之亦然)

其次是你的 radio

onclick=&quot;displayPersonOrCompanySearchFields(); resetSearchFields()&quot;

这不会按你想要的方式运行。你应该检查如何在一个 onclick 上执行多个函数。

第三,缺少 const subjectType = getSubjectType();

最后,

&lt;div id=&quot;person-search-states&quot; style=&quot;display: none;&quot;&gt;

然后

&lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen; display: none;&quot;&gt;

实际上不必隐藏表单。

有许多需要调试的点,很难逐一指出,所以请整理你的代码。

我只整理了一些代码,你可以将其用作 草稿

<!-- begin snippet: js hide: true console: true babel: false -->

<!-- language: lang-js -->

function displayPersonOrCompanySearchFields(){
  let person = document.getElementById(&quot;person-subject&quot;);
  let company = document.getElementById(&quot;company-subject&quot;);
  let person_states = document.getElementById(&quot;person-search-states&quot;);
  let company_states = document.getElementById(&quot;company-search-states&quot;);
  let person_field = document.getElementById(&quot;person-search-field&quot;);
  let company_field = document.getElementById(&quot;company-search-field&quot;);
  
  if(person.checked === true){
    person_states.style.display = &quot;block&quot;;
    person_field.style.display = &quot;block&quot;;
    company_states.style.display = &quot;none&quot;;
    company_field.style.display = &quot;none&quot;;
  }else{
    company_states.style.display = &quot;block&quot;;
    company_field.style.display = &quot;block&quot;;
    person_states.style.display = &quot;none&quot;;
    person_field.style.display = &quot;none&quot;;
  }
}

<!-- language: lang-html -->

<div class=&quot;container&quot;>
    <p class=&quot;title&quot;>MESA Canada</p>
</div>
...
英文:

Your code is hard to read and there's a lot of errors.

First, look what you have here.

&lt;input type=&quot;radio&quot; onclick=&quot;displayPersonOrCompanySearchFields(); resetSearchFields()&quot; id=&quot;person-subject&quot; name=&quot;subject-type&quot; value=&quot;person-subject&quot; checked&gt;
&lt;label for=&quot;person-subject&quot;&gt;Company&lt;/label&gt;
&lt;input type=&quot;radio&quot; onclick=&quot;displayPersonOrCompanySearchFields(); resetSearchFields()&quot; id=&quot;company-subject&quot; name=&quot;subject-type&quot; value=&quot;company-subject&quot;&gt;
&lt;label for=&quot;company-subject&quot;&gt;Person&lt;/label&gt;

label is Company but detail(id, value) is for Person (vice versa)

Second is your radio.

onclick=&quot;displayPersonOrCompanySearchFields(); resetSearchFields()&quot;

This shouldn't run as you want. You should check how to do a multiple function on one onclick.

Third,const subjectType = getSubjectType(); is missing.

Lastly,

&lt;div id=&quot;person-search-states&quot; style=&quot;display: none;&quot;&gt;

Then

&lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen; display: none;&quot;&gt;

It's actually not necessary to hide the form.

There are many points to debug and hard to indicate 1 by 1, so please arrange your code.

I just arrange some of the codes, so you can use this as your scratch.

<!-- begin snippet: js hide: true console: true babel: false -->

<!-- language: lang-js -->

function displayPersonOrCompanySearchFields(){
let person = document.getElementById(&quot;person-subject&quot;);
let company = document.getElementById(&quot;company-subject&quot;);
let person_states = document.getElementById(&quot;person-search-states&quot;);
let company_states = document.getElementById(&quot;company-search-states&quot;);
let person_field = document.getElementById(&quot;person-search-field&quot;);
let company_field = document.getElementById(&quot;company-search-field&quot;);
if(person.checked === true){
person_states.style.display = &quot;block&quot;;
person_field.style.display = &quot;block&quot;;
company_states.style.display = &quot;none&quot;;
company_field.style.display = &quot;none&quot;;
}else{
company_states.style.display = &quot;block&quot;;
company_field.style.display = &quot;block&quot;;
person_states.style.display = &quot;none&quot;;
person_field.style.display = &quot;none&quot;;
}
}

<!-- language: lang-html -->

&lt;div class=&quot;container&quot;&gt;
&lt;p class=&quot;title&quot;&gt;MESA Canada&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&quot;company-search-field&quot;&gt;
&lt;input style=&quot;background-color: white; margin-left: 1rem; width: 300px; line-height: 5;&quot; placeholder=&quot;Insert company name here&quot; /&gt;
&lt;/div&gt;
&lt;div id=&quot;person-search-field&quot; style=&quot;display: none;&quot;&gt;
&lt;input style=&quot;background-color: white; margin-left: 1rem; width: 300px; line-height: 5;&quot; placeholder=&quot;Insert person name here&quot; /&gt;
&lt;/div&gt;
&lt;br&gt;&lt;/br&gt;
&lt;div class=&quot;search-subject&quot; style=&quot;margin-left: 1rem;&quot;&gt;
&lt;input type=&quot;radio&quot; onclick=&quot;displayPersonOrCompanySearchFields()&quot; id=&quot;company-subject&quot; name=&quot;subject-type&quot; value=&quot;company-subject&quot; checked&gt;
&lt;label for=&quot;company-subject&quot;&gt;Company&lt;/label&gt;
&lt;input type=&quot;radio&quot; onclick=&quot;displayPersonOrCompanySearchFields()&quot; id=&quot;person-subject&quot; name=&quot;subject-type&quot; value=&quot;person-subject&quot;&gt;
&lt;label for=&quot;person-subject&quot;&gt;Person&lt;/label&gt;
&lt;/div&gt;
&lt;br&gt;&lt;/br&gt;
&lt;!-- WHEN COMPANY IS SELECTED --&gt;
&lt;div id=&quot;company-search-states&quot;&gt;
&lt;div class=&quot;states-dropdown-list&quot;&gt;
&lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;&quot;&gt;
&lt;b style=&quot;margin-left: 1rem;&quot;&gt;&lt;span style=&quot;color: darkgreen;&quot;&gt;Corporate Records&lt;/span&gt; and &lt;span style=&quot;color: darkgreen;&quot;&gt;Litigation&lt;/span&gt; Research&lt;/b&gt;
&lt;div style=&quot;border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 26rem; background-color: black;&quot;&gt;
&lt;svg style=&quot;color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; class=&quot;bi bi-geo&quot; viewBox=&quot;0 0 16 16&quot;&gt; &lt;path fill-rule=&quot;evenodd&quot; d=&quot;M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z&quot; fill=&quot;white&quot;&gt;&lt;/path&gt; 
&lt;/svg&gt;
&lt;/div&gt;
&lt;ul class=&quot;states-dropdown&quot; style=&quot;list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;&quot;&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot; checked&gt;Federal Level&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot;&gt;Alberta&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;jakarta&quot;&gt;British Columbia&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;aceh&quot;&gt;Manitoba&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bali&quot;&gt;New Brunswick&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bangka-belitung&quot;&gt;Newfoundland and Labrador&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;banten&quot;&gt;Nova Scotia&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bengkulu&quot;&gt;Ontario&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-java1&quot;&gt;Prince Edward Island&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-java2&quot;&gt;Quebec&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-kalimantan&quot;&gt;Saskatchewan&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-papua&quot;&gt;Northwest Territories&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-sulawesi&quot;&gt;Nunavut&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;east-java1&quot;&gt;Yukon&lt;/label&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;*OpenCorporates will open&lt;/span&gt;
&lt;br&gt;
&lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;**Canada&#39;s Business Registries will open&lt;/span&gt;
&lt;br&gt;&lt;/br&gt;
&lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
&lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
&lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
&lt;/svg&gt;
Search Corporate Records&lt;/button&gt;
&lt;br&gt;&lt;/br&gt;
&lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
&lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
&lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
&lt;/svg&gt;
Search Litigation Cases&lt;/button&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;!-- WHEN PERSON IS SELECTED --&gt;
&lt;div id=&quot;person-search-states&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;states-dropdown-list&quot;&gt;
&lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;;&quot;&gt;
&lt;b style=&quot;margin-left: 1rem;&quot;&gt;&lt;span style=&quot;color: darkgreen;&quot;&gt;Corporate Affiliations&lt;/span&gt; and &lt;span style=&quot;color: darkgreen;&quot;&gt;Litigation&lt;/span&gt; Research&lt;/b&gt;
&lt;div style=&quot;border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 28rem; background-color: black;&quot;&gt;
&lt;svg style=&quot;color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; class=&quot;bi bi-geo&quot; viewBox=&quot;0 0 16 16&quot;&gt; &lt;path fill-rule=&quot;evenodd&quot; d=&quot;M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z&quot; fill=&quot;white&quot;&gt;&lt;/path&gt; 
&lt;/svg&gt;
&lt;/div&gt;
&lt;ul class=&quot;states-dropdown&quot; id=&quot;provinces-list&quot; style=&quot;list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;&quot;&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot; checked&gt;Federal Level&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot;&gt;Alberta&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;jakarta&quot;&gt;British Columbia&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;aceh&quot;&gt;Manitoba&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bali&quot;&gt;New Brunswick&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bangka-belitung&quot;&gt;Newfoundland and Labrador&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;banten&quot;&gt;Nova Scotia&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bengkulu&quot;&gt;Ontario&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-java1&quot;&gt;Prince Edward Island&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-java2&quot;&gt;Quebec&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-kalimantan&quot;&gt;Saskatchewan&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-papua&quot;&gt;Northwest Territories&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-sulawesi&quot;&gt;Nunavut&lt;/label&gt;&lt;/li&gt;
&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;east-java1&quot;&gt;Yukon&lt;/label&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;*OpenCorporates will open&lt;/span&gt;
&lt;br&gt;
&lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;**Canada&#39;s Business Registries will open&lt;/span&gt;
&lt;br&gt;&lt;/br&gt;
&lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
&lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
&lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
&lt;/svg&gt;
Search Corporate Records&lt;/button&gt;
&lt;br&gt;&lt;/br&gt;
&lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
&lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
&lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
&lt;/svg&gt;
Search Litigation Cases&lt;/button&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;/div&gt;

<!-- end snippet -->

答案2

得分: 0

以下是翻译好的部分:

首先,请确保您具有正确的布局,将display: none添加到单个父元素,您有多个display: none选项用于人员选择选项列表。

还要在onchange中使用单个函数,并将this作为参数传递,这将使检查当前选择的值变得更容易。

这是更新后的代码:

/* 输入 */
const personSearchField = document.getElementById('person-search-field');
const companySearchField = document.getElementById('company-search-field');

/* 选择选项 */
const personSearchArea = document.getElementById('person-search-states');
const companySearchArea = document.getElementById('company-search-states');

function handleChange(e) {
  if (e.value === "company-subject") {
    personSearchField.style.display = "none"
    personSearchArea.style.display = "none"
    companySearchField.style.display = "block"
    companySearchArea.style.display = "block"
  } else {
    companySearchArea.style.display = "none"
    companySearchField.style.display = "none"
    personSearchField.style.display = "block"
    personSearchArea.style.display = "block"
  }
}
<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="canada.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script defer src="/canada.js"></script>
    <title>MESA Canada</title>
  </head>

  <body>
    <div class="container">
      <p class="title">MESA Canada</p>
    </div>
    <div id="company-search-field">
      <input style="background-color: white; margin-left: 1rem; width: 300px; line-height: 5;" placeholder="在此处插入公司名称" />
    </div>
    <div id="person-search-field" style="display: none;">
      <input style="background-color: white; margin-left: 1rem; width: 300px; line-height: 5;" placeholder="在此处插入个人姓名" />
    </div>
    <br />
    <div class="search-subject" style="margin-left: 1rem;">
      <input type="radio" onclick="handleChange(this)" id="company-subject" name="subject-type" value="company-subject" checked>
      <label for="company-subject">公司</label>
      <input type="radio" onclick="handleChange(this)" id="person-subject" name="subject-type" value="person-subject">
      <label for="person-subject">个人</label>
    </div>
    <br />
    <div class="subject-name-search">
      <div id="subject-search-form">
        <!-- 当选择公司时 -->
        <div id="company-search-states">
          <div class="states-dropdown-list">
            <form action="" onsubmit="return false;" style="width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;">
              <b style="margin-left: 1rem;"><span style="color: darkgreen;">公司记录</span>和<span style="color: darkgreen;">诉讼</span>研究</b>
              <div style="border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 26rem; background-color: black;">
                <svg style="color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo" viewBox="0 0 16 16">
                  <path fill-rule="evenodd" d="M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.

<details>
<summary>英文:</summary>

First, make sure you have correct layout, add `display: none` to single parent, you have multiple `display: none` for person&#39;s select options list.

Also use a single function in `onchange`, and pass `this` as a parameter, that will make it easy to check which value is currently selected.



Here is the updated code:

&lt;!-- begin snippet: js hide: false console: true babel: false --&gt;

&lt;!-- language: lang-js --&gt;

    /* inputs */
    const personSearchField = document.getElementById(&#39;person-search-field&#39;);
    const companySearchField = document.getElementById(&#39;company-search-field&#39;);

    /* select options */
    const personSearchArea = document.getElementById(&#39;person-search-states&#39;);
    const companySearchArea = document.getElementById(&#39;company-search-states&#39;);

    function handleChange(e) {
      if (e.value === &quot;company-subject&quot;) {
        personSearchField.style.display = &quot;none&quot;
        personSearchArea.style.display = &quot;none&quot;
        companySearchField.style.display = &quot;block&quot;
        companySearchArea.style.display = &quot;block&quot;
      } else {
        companySearchArea.style.display = &quot;none&quot;
        companySearchField.style.display = &quot;none&quot;
        personSearchField.style.display = &quot;block&quot;
        personSearchArea.style.display = &quot;block&quot;
      }
    }


&lt;!-- language: lang-html --&gt;

    &lt;!DOCTYPE html&gt;
    &lt;html lang=&quot;en&quot;&gt;

      &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;canada.css&quot;&gt;
        &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js&quot;&gt;&lt;/script&gt;
        &lt;script defer src=&quot;/canada.js&quot;&gt;&lt;/script&gt;
        &lt;title&gt;MESA Canada&lt;/title&gt;
      &lt;/head&gt;

      &lt;body&gt;
        &lt;div class=&quot;container&quot;&gt;
          &lt;p class=&quot;title&quot;&gt;MESA Canada&lt;/p&gt;
        &lt;/div&gt;
        &lt;div id=&quot;company-search-field&quot;&gt;
          &lt;input style=&quot;background-color: white; margin-left: 1rem; width: 300px; line-height: 5;&quot; placeholder=&quot;Insert company name here&quot; /&gt;
        &lt;/div&gt;
        &lt;div id=&quot;person-search-field&quot; style=&quot;display: none;&quot;&gt;
          &lt;input style=&quot;background-color: white; margin-left: 1rem; width: 300px; line-height: 5;&quot; placeholder=&quot;Insert person name here&quot; /&gt;
        &lt;/div&gt;
        &lt;br /&gt;
        &lt;div class=&quot;search-subject&quot; style=&quot;margin-left: 1rem;&quot;&gt;
          &lt;input type=&quot;radio&quot; onclick=&quot;handleChange(this)&quot; id=&quot;company-subject&quot; name=&quot;subject-type&quot; value=&quot;company-subject&quot; checked&gt;
          &lt;label for=&quot;company-subject&quot;&gt;Company&lt;/label&gt;
          &lt;input type=&quot;radio&quot; onclick=&quot;handleChange(this)&quot; id=&quot;person-subject&quot; name=&quot;subject-type&quot; value=&quot;person-subject&quot;&gt;
          &lt;label for=&quot;person-subject&quot;&gt;Person&lt;/label&gt;
        &lt;/div&gt;
        &lt;br /&gt;
        &lt;div class=&quot;subject-name-search&quot;&gt;
          &lt;div id=&quot;subject-search-form&quot;&gt;
            &lt;!-- WHEN COMPANY IS SELECTED --&gt;
            &lt;div id=&quot;company-search-states&quot;&gt;
              &lt;div class=&quot;states-dropdown-list&quot;&gt;
                &lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;&quot;&gt;
                  &lt;b style=&quot;margin-left: 1rem;&quot;&gt;&lt;span style=&quot;color: darkgreen;&quot;&gt;Corporate Records&lt;/span&gt; and &lt;span style=&quot;color: darkgreen;&quot;&gt;Litigation&lt;/span&gt; Research&lt;/b&gt;
                  &lt;div style=&quot;border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 26rem; background-color: black;&quot;&gt;
                    &lt;svg style=&quot;color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; class=&quot;bi bi-geo&quot; viewBox=&quot;0 0 16 16&quot;&gt;
                      &lt;path fill-rule=&quot;evenodd&quot; d=&quot;M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z&quot; fill=&quot;white&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                  &lt;/div&gt;
                  &lt;ul class=&quot;states-dropdown&quot; style=&quot;list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;&quot;&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot; checked&gt;Federal Level&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot;&gt;Alberta&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;jakarta&quot;&gt;British Columbia&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;aceh&quot;&gt;Manitoba&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bali&quot;&gt;New Brunswick&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bangka-belitung&quot;&gt;Newfoundland and Labrador&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;banten&quot;&gt;Nova Scotia&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;bengkulu&quot;&gt;Ontario&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-java1&quot;&gt;Prince Edward Island&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-java2&quot;&gt;Quebec&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-kalimantan&quot;&gt;Saskatchewan&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-papua&quot;&gt;Northwest Territories&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;central-sulawesi&quot;&gt;Nunavut&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;company-subject&quot; class=&quot;state&quot; value=&quot;east-java1&quot;&gt;Yukon&lt;/label&gt;&lt;/li&gt;
                  &lt;/ul&gt;
                  &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;*OpenCorporates will open&lt;/span&gt;
                  &lt;br&gt;
                  &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;**Canada&#39;s Business Registries will open&lt;/span&gt;
                  &lt;br /&gt;
                  &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                      &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Corporate Records&lt;/button&gt;
                  &lt;br /&gt;
                  &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                      &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Litigation Cases&lt;/button&gt;
                &lt;/form&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;!-- WHEN PERSON IS SELECTED --&gt;
            &lt;div id=&quot;person-search-states&quot; style=&quot;display: none;&quot;&gt;
              &lt;div class=&quot;states-dropdown-list&quot;&gt;
                &lt;form action=&quot;&quot; onsubmit=&quot;return false;&quot; style=&quot;width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;&quot;&gt;
                  &lt;b style=&quot;margin-left: 1rem;&quot;&gt;&lt;span style=&quot;color: darkgreen;&quot;&gt;Corporate Affiliations&lt;/span&gt; and &lt;span style=&quot;color: darkgreen;&quot;&gt;Litigation&lt;/span&gt; Research&lt;/b&gt;
                  &lt;div style=&quot;border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 28rem; background-color: black;&quot;&gt;
                    &lt;svg style=&quot;color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; class=&quot;bi bi-geo&quot; viewBox=&quot;0 0 16 16&quot;&gt;
                      &lt;path fill-rule=&quot;evenodd&quot; d=&quot;M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z&quot; fill=&quot;white&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                  &lt;/div&gt;
                  &lt;ul class=&quot;states-dropdown&quot; id=&quot;provinces-list&quot; style=&quot;list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;&quot;&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot; checked&gt;Federal Level&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;supreme-court&quot;&gt;Alberta&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;jakarta&quot;&gt;British Columbia&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;aceh&quot;&gt;Manitoba&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bali&quot;&gt;New Brunswick&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bangka-belitung&quot;&gt;Newfoundland and Labrador&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;banten&quot;&gt;Nova Scotia&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;bengkulu&quot;&gt;Ontario&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-java1&quot;&gt;Prince Edward Island&lt;sup style=&quot;font-size: x-small;&quot;&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-java2&quot;&gt;Quebec&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-kalimantan&quot;&gt;Saskatchewan&lt;sup style=&quot;font-size: x-small;&quot;&gt;**&lt;/sup&gt;&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-papua&quot;&gt;Northwest Territories&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;central-sulawesi&quot;&gt;Nunavut&lt;/label&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;person-subject&quot; class=&quot;state&quot; value=&quot;east-java1&quot;&gt;Yukon&lt;/label&gt;&lt;/li&gt;
                  &lt;/ul&gt;
                  &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;*OpenCorporates will open&lt;/span&gt;
                  &lt;br&gt;
                  &lt;span style=&quot;font-size: x-small; position: absolute; padding: 0.5rem;&quot;&gt;**Canada&#39;s Business Registries will open&lt;/span&gt;
                  &lt;br /&gt;
                  &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                      &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Corporate Records&lt;/button&gt;
                  &lt;br /&gt;
                  &lt;button style=&quot;background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;&quot; onclick=&quot;openBankruptcyTabs();&quot;&gt;
                    &lt;svg class=&quot;svg-icon&quot; viewBox=&quot;0 -3 20 20&quot; style=&quot;width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;&quot;&gt;
                      &lt;path fill=&quot;white&quot; d=&quot;M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z&quot;&gt;&lt;/path&gt;
                    &lt;/svg&gt;
                    Search Litigation Cases&lt;/button&gt;
                &lt;/form&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/body&gt;

    &lt;/html&gt;


&lt;!-- end snippet --&gt;



</details>



huangapple
  • 本文由 发表于 2023年5月10日 15:33:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76215959.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定