按钮设置显示另一个但不是document.getElement不起作用?

时间:2016-04-07 11:36:55

标签: javascript jquery html

我正在使用下面的html和js来显示和隐藏点击图片和按钮,我知道这是一个简单的错误,但无法解决它的位置,任何帮助?

HTML

<div class="row">
        <div class="col-md-12">
            <a id="imgbutton" class="btn btn-success form-control" style="display:block" onClick="streetviewshow();">Click here to see the street view image</a>
            <a id="imgbuttonhide" class="btn btn-success form-control" style="display:none" onClick="streetviewhide();">Click here to hide the street view image</a>
        </div>
    </div>

JS

<script type="text/javascript">
    function streetviewshow(){
        document.getElementById('showimg').style.display = 'block';
        document.getElementById('imgbutton').style.display = 'none';
        document.getElementById('imgbuttonhide').style.display = 'block';
    }
    function streetviewhide(){
        document.getElementById('showimg').style.display = 'none';
        document.getElementById('imgbutton').style.display = 'block';
        document.getElementById('imgbuttonhide').style.display = 'none';
    }
</script>

0 个答案:

没有答案