나는이 텍스트 영역 내 선택/클릭 웃는 삽입 (여러 개의 파일 내에 배치되어) 다음과 같은 HTML 코드 :JavaScript 스마일 기능이 스마일을 적절한 텍스트 영역에 배치하지 않습니까?
<a href="javascript:putTheSmiley(':)');void(0)"><img src="images/smile.gif" alt=":)" title=":)" /></a>
:
<a href="javascript:insertTheSmiley(':)');void(0)"><img src="images/smile.gif" alt=":)" title=":)" /></a>
<!-- this is a link to open a popup listing all smilies (see smilies.html to see what it contains) -->
<a href="#" onClick="window.open('smilies.html', 'Smilies', 'width=250,height=500,scrollbars=1');">Show all smilies</a>
<textarea id="textarea" cols="60" rows="10" style="width: 100%"></textarea>
<a href="javascript:insertTheSmiley(':)');void(0)"><img src="images/smile.gif" alt=":)" title=":)" /></a>
<!-- this is a link to open a popup listing all smilies (see smilies.html to see what it contains) -->
<a href="#" onClick="window.open('smilies.html', 'Smilies', 'width=250,height=500,scrollbars=1');">Show all smilies</a>
<textarea id="textarea" cols="60" rows="10" style="width: 100%"></textarea>
smilies.html는 다음과 같은 HTML을 포함 사용
와 자바 스크립트의 기능은 다음과 같습니다 그것을 할 수 있도록 내가하려는거야 무엇
<script>
function insertTheSmiley(input) {
document.getElementById('textarea').value += input;
}
function putTheSmiley(input) {
window.opener.insertTheSmiley(input);
}
</script>
적절한의 선택/클릭 웃는 곳입니다 (예를 들어 시나리오 등) 텍스트 영역, 현재 내가 두 번째 웃는 링크를 클릭하면 (aswell smilies.html 내로)는 그러나 나는 무엇 인 (두 번째 내에 배치 할 첫 번째 텍스트 영역 내에서 웃는 배치 I 적절한 하나를 고려하십시오) - 이것은 단지 내 문제를 설명하기위한 예입니다.
나는 요소 ID와의 문제를 추측하고있어,이 또는 해결 방법을 자동화하는 그 어떤 식 으로든 내가 이렇게 많은 포럼 소프트웨어를 보았 듯이, 무엇입니까?
는 Heres는 (작동하지 않는 것) 생각 : 모든
<script>
function insertTheSmiley(input, id) {
global id;
document.getElementById(id).value += input;
}
function putTheSmiley(input) {
global id;
window.opener.insertTheSmiley(input, id);
}
</script>
덕분에 응답을, 나는 내가 뭘 잘못했는지에 alook 걸릴 수 있습니다, 내 최초의 질문 내에을 insertTheSmiley() 함수를 편집하고, 포함했다? – Newbtophp
@Newbtophp 다음'글로벌 ID를 제거, 기능에'. –