-3

画像「imgAdd」をクリックして、JavaScript を使用して div「divAddCustomerInfo」の可視性を true に設定したいと思います。しかし、画像をクリックしてもうまくいきません。JavaScriptが動かないからだと思います。誰でも助けることができますか?事前にヤンク。

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <script type="text/javascript">
    function imgAdd_click() {
        document.getElementById("divAddCustomerInfo").style.visibility = 'visible';
    }
</script>
<div id="divCustomerBody" style="margin-left:300px; margin-top:50px;">
    <h1>Customer</h1>
    <hr style="color:gray; width:900px; margin-left: 0px;" />
    <br />
    <div id="divOperationSymbol" style="height:100px; width:900px; ">

        <div id="divAddition" onclick="divAddition_click()" style="height:100px; float:left; width:300px; " >
            <img id="imgAdd" onclick="imgAdd_click()" src="001446-3d-transparent-glass-icon-media-a-media35-add.png" style="height:70px; width:70px; display:block; margin-left:auto; margin-right:auto;" />
            <label id="lblAdd" onclick="lblADD_click()" style="color: #a6a6a6; margin-left:100px;">Add Customer</label>
        </div>

    </div>
</div>
    <div id="divAddCustomerInfo" style="visibility: hidden; margin-left:300px; margin-top:50px;">

</div>

4

3 に答える 3

1

以下を変更

<div id="divAddCustomerInfo" runat="server" visible="false" style="margin-left:300px; margin-top:50px;">

の中へ

<div id="divAddCustomerInfo" runat="server" style="visibility:hidden;margin-left:300px; margin-top:50px;">
于 2016-09-08T06:55:16.050 に答える
0

次の部分を次のように更新します。

<div id="divAddition" onclick="divAddition_click()" style="height:100px; float:left; width:300px; " >
            <img id="imgAdd" onclick="imgAdd_click()" src="001446-3d-transparent-glass-icon-media-a-media35-add.png" style="height:70px; width:70px; display:block; margin-left:auto; margin-right:auto;" />
            <label id="lblAdd" onclick="lblADD_click()" style="color: #a6a6a6; margin-left:100px;">Add Customer</label>
        </div>
于 2016-09-08T06:53:13.337 に答える