0

Title="Full Name"唯一の問題は、ページ上のすべてを英語、フランス語、またはスペイン語に翻訳する JavaScript トランスレータをコーディングしたことです。タイトルも更新してほしい。

を使用してみましdocument.getElementByIdたが、うまくいきません。フォームの中にあるからだと思います。これは、私のフォームを構成する html のコピーです。

    <form id="signupform" method="post" action="login.php">
            <div class="field"><input type="text" class="box" id="name" name="fullname" title="Full Name"></div>
            <div class="field"><input type="email" class="box" id="email" name="useremail" title="Email Address"></div>
            <div class="field"><input type="password" class="box" id="pass" name="password" title="Password"></div>
            <div class="field"><input type="password" class="box" id="confirmpass" name="confirm" title="Confirm Password"></div>
            <div id="lowersignuparea"> 
            <table width="306" cellspacing="0" cellpadding="0" align="center">
            <tr>
            <td><span id="signuperror"><?php echo $signuperror ?></span></td>
            <td width="87"><span><input type="submit" class="signupbutton" id="signupbtn" value="Sign Up" style="cursor:pointer;"></span></td>
            </tr>
            </table>
            </div>
  </form>

JavaScript を使用してテキスト ボックスのタイトルを変更する方法についてのアイデアはありますか?

ありがとう。-ライアン

4

2 に答える 2

0

このようにJavaScriptを使用してタイトル値を設定できます。

document.getElementById("elementid").setAttribute("title", "my new title");
于 2013-01-29T05:22:12.783 に答える
0

以下のように、ready イベントでコードをラップする必要があります。

<script type="text/javascript">
    $(document).ready(function() {
        $('form input').each(function(){
            var translated = translateYourTitlte($(this).attr('title'));
            $(this).attr('title', translated);
        });
    });
</script>

ツールチップの表示に使用しているプラ​​グイン名を指定する必要があります。

于 2013-01-29T05:34:49.050 に答える