首页 > 开发 > CSS > 正文

web开发问题,实现点击图标和其余空白地方,跳转到不同的页面

2017-09-12 09:38:57  来源: 网友分享


点击图标跳转到页面1,点击其他地方跳转到界面2,而且点击其他地方的时候,整体要有蓝色边框,这个怎么实现。
现在的情况是点击图标也会跳转到页面2.

<label id="option1" value="1" name="options" class=" btn btn-block container-address"  style="text-align: left;">       <div class="width-75 pull-left info-box " >          <input type="radio" >              <div class="row col-xs-12">                                <div id="text" class="width-30 pull-left text">AAA:</div>                                <div id="name1" class="width-30 pull-left name">BBB</div>                                <div id="phone1" class="width-40 pull-left phone">BBB</div>                                <div id="address1" class="address">BBB</div>                            </div>                        </div>                        <div class="width-20 pull-right btn block-btn ">                            <center class="icon-edit icon-button2 icon-block"><a href="enterAddress.html"><span ></span></a></center>       </div></label>

解决方案

没用阻止事件冒泡
1. event.preventDefault(); -- 阻止元素的默认事件。
2. event.stopPropagation(); -- 阻止元素冒泡事件