0

クライアント側のスクリプトからオートコンプリートのブラウザー設定を検出する方法はありますか? 異なるブラウザーには、diff オートコンプリート設定があります。

オートコンプリート機能のクライアント ブラウザー設定に基づいて、テキスト フィールドに autocomplete="off" を追加したいと考えています。

4

1 に答える 1

1

友達、ググってみませんか.....

http://help.dottoro.com/ljdwgiwh.php

Example Code:

ユーザー名と都市のフィールドにテキスト コンテンツを入力し、フォームを送信します。
その後、これらのフィールドに同じ内容を入力し始めます。ユーザー名フィールドにオートコンプリート ウィンドウが表示されます。

  <head>
    <script type="text/javascript">
        function DisableAutoComp () {
            var username = document.getElementById ("username");
            if ('autocomplete' in username) {
                username.autocomplete = "off";
            }
            else {
                    // Firefox
                username.setAttribute ("autocomplete", "off");
            }
        }
    </script>
</head>
<body>
    Fill the user name and city fields with some text content, and submit the form.<br />
    After that, start to fill these fields with the same content. An autocomplete window will displayed for to the user name field.
    <br /><br />
    <form method="post" action="#URL#">
        User name, with autocompletion:
        <input type="text" id="username" name="username" autocomplete="on" />
        <br />
        City, without autocompletion:
        <input type="text" name="city" autocomplete="off" />

        <br /><br />
        <input type="submit" value="Send" />
    </form>
    <br />
    <button onclick="DisableAutoComp ();">Disable autocompletion!</button>
</body>
于 2012-09-25T08:56:34.537 に答える