0

次の問題があります。行ごとに、いくつかのテキストと、サーバーへの取得要求を介して状態をオンとオフの間で切り替えるボタンを含むオプション ダイアログを作成しました。

ボタンにカーソルを合わせると、「ホバー」状態で強調表示され、クリックすると「クリック」状態になり、マウスを離すと再び正常になります。それは正常な動作であるため、まさに私が期待していることです。

しかし、私がやりたいことは、どこにも見つからないため、私を夢中にさせています.マウスのホバリングやクリックにボタンが反応せず、「クリックされた」状態を有効または無効にできることです.サーバーの応答とともに。どうすればこれを達成できますか?

ダイアログとボタンを初期化する次のコードがあります。

<script>
    $(document).ready(function() {
        $("#dlg1").dialog();
        $(".settings_buttons").button();
    });
</script>

そして、ダイアログとボタンの HTML セットアップ:

    <div id="dlg1" title="Global device settings" class="dialog_window">

        <table>
            <form>
                <tr>
                    <td><h2>Setting</h2></td>
                    <td><button id="btn2" class="settings_buttons">OFF</button></td>
                </tr>
            </form>
        </table>

    </div>

4

2 に答える 2

1

ボタンを無効にしようとしましたか? それは最速ですが、おそらく最善の解決策ではありません:

<td><button id="btn2" class="settings_buttons" disabled="disabled">OFF</button></td>

クローズブラウザの結果には、 disabled="disabled"を使用する必要があります。

于 2012-12-31T13:44:38.443 に答える
0

次のように、すべてのボタンのスタイルを定義できます。

.dupe{
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background-image: -webkit-gradient(
    linear,
    left bottom,
    left top,
    color-stop(0.16, rgb(207,207,207)),
    color-stop(0.79, rgb(252,252,252))
);
     background-image: -moz-linear-gradient(
    center bottom,
    rgb(207,207,207) 16%,
    rgb(252,252,252) 79%
);
padding:0px;
border:1px solid #6e6b6b;}

デモを見る

于 2012-12-31T13:36:43.280 に答える