我有一个链接,当它点击时,它打开了另一个浏览器窗口(specialchar .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('á')"><span class="specialchar">á</span></a></td>
</tr>
</table>
当一个带有特殊字符的链接被点击时,insert_text()将被调用。而alert则表现出了它的特殊性。但我想把那个字符附加到打开器窗口的文本区域。但是它不工作。
如何表示打开器窗口的文本区域?
给textarea一个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();
}
并开始向文本区域追加字符