1

リンクがあります。クリックすると、ブラウザの別のウィンドウが開きます (specialChars.php)

function popup_specialChars()
    {

        var ht;
        if(window.navigator.appVersion.indexOf("MSIE 5.01") == -1)
            ht = 300;
        else
            ht = 720;
        specialCharsWindow = window.open
        (
            "/TradeScienceJournalSystem/specialChars.php", "special_characters",
            "resizable=yes,scrollbars=yes,height=" + ht + ",width=650,dependent=yes,alwaysRaised=yes"
        );
        specialCharsWindow.focus();
    }

<a href="javascript:popup_specialChars();" class="special">Insert Special Character</a>
<textarea name="docArticleTitle" cols="60" rows="14"></textarea>

specialChars.php

function insert_text(str)
        {
                    alert(str);

            opener.append(str); // Not working
            this.window.focus();
        }

<table border="1" id="table1" width="97%">
                <tr>
                    <td align="center" class="specialcharlink"><a href="javascript:insert_text('&#x00E1;')"><span class="specialchar">&#x00E1;</span></a></td>
                </tr>
</table>

特殊文字のリンクをクリックすると、insert_text() が呼び出され、アラートに特殊文字が表示されます。しかし、その文字をオープナー ウィンドウのテキスト領域に追加したいのですが、うまくいきません。

オープナーウィンドウのテキストエリアをどのように示すことができますか?

4

1 に答える 1

1

テキストエリアにIDを付与

<textarea name="docArticleTitle" id="id1" cols="60" rows="14"></textarea>

そして変わった

function insert_text(str)
        {
                    window.opener.document.getElementById('id1').value += str;
                    this.window.focus();
        }

そして、テキストエリアに文字を追加し始めます。

于 2013-04-26T11:10:58.180 に答える