控制div层的显示以及隐藏
控制div层的显示以及隐藏,例如,点击登录,弹出登录的层。
1、添加script代码
<script> function add_address(){ $('#popup2').show(); $('#gray').show(); } function closeAddressDiv(){ $('#popup2').hide(); } </script>
2、在body标签里面添加如下的div
<div class="popup2" id="popup2"> <div class="top_nav" id='top_nav2'> <div align="center"> <span>新增收货地址</span> <a class="guanbi" href="javascript:void(0);" onclick="closeAddressDiv()"></a> </div> </div> <table cellpadding="0" cellspacing="0" class="my_address2"> <tr> <th><span class="red">*</span>所在地区:</th> <td><input type="text" class="text_input" placeholder="请选择省市区"> </td> </tr> <tr> <th><span class="red">*</span>详细地址:</th> <td><input type="text" class="text_input long" placeholder="建议您如实填写详细地址,例如街道名称、门牌号码、楼层和房间号等信息"> </td> </tr> <tr> <th><span class="red">*</span>邮政编码:</th> <td><input type="text" class="text_input" placeholder="如您不清楚邮递编号,请填写000000"> </td> </tr> <tr> <th><span class="red">*</span>收货人姓名:</th> <td><input type="text" class="text_input" placeholder="长度不超过25个字符"> </td> </tr> <tr> <th><span class="red">*</span>手机号码:</th> <td> <select name="select" id="select" class="select_form"> <option >中国大陆 +86</option> </select> <input type="text" class="text_input" placeholder="手机号码、电话号码必须填一项">
</td> </tr> <tr> <th>电话号码:</th> <td> <select name="select" id="select" class="select_form"> <option >中国大陆 +86</option> </select> <input type="text" class="text_input small1" placeholder="区号"> - <input type="text" class="text_input small2" placeholder="电话号码"> - <input type="text" class="text_input small3" placeholder="分机号"> </td> </tr> <tr> <th></th> <td><input type="checkbox" checked> 设为默认收货地址</td> </tr> <tr> <th></th> <td><input type="submit" class="but_input" value="保 存"></td> </tr> </table> </div>