lqw4

js div隐藏和显示

HTML代码

<tr><td>
            <p  class="short-input staff ue-clear">
                <label>公司类型:</label>
                <select class="l-select" onchange="cascadetype(this)" data-sub="公司名称,companyname" name="enterprisetype" id="enterprisetype" style="height:28px;">
                <?php echo Ousuclass::all_html_option($companytypelist,\'name\');?>
                </select>
  </p></td>

</tr>

<div id="SG" style="display:none;">
            <table >
            <tr><td>
                <p  class="short-input staff ue-clear">
                <label>分包项目:</label>
                <input  name="projectname" id="projectname" style="height:28px;"/>
                    <span><em>*</em></span>
                </p></td><td>
            <p  class="short-input staff ue-clear">
                <label>造价(万元):</label>
                <input   name="constructcost" id="constructcost" style="height:28px;"/>
                <span><em>*</em></span>
                </p></td>
            </tr>

           </table>

</div>

js代码

function cascadetype(obj)
{
    var traget=document.getElementById("SG");
    if(obj.value == \'<?php echo $SG;?>\')
    {
        traget.style.display = \'\';
    }
    else
    {
        traget.style.display = \'none\';
    }

}

PHP代码

<?php

        $query = $this->mydb->find("select * from dictdatas where type = \'companytype\'");
        $data[\'companytypelist\'] = $query[\'obj\'];
        $data[\'SG\'] = \'施工单位\';

?>

 

分类:

技术点:

相关文章:

  • 2021-11-02
  • 2021-11-03
  • 2021-11-25
  • 2021-11-05
  • 2021-11-13
  • 2021-12-28
猜你喜欢
  • 2021-10-29
  • 2021-06-14
  • 2021-11-13
  • 2021-11-23
  • 2021-12-27
  • 2021-11-23
  • 2021-11-23
相关资源
相似解决方案