Autor | Zpráva | ||
---|---|---|---|
Jack06 Profil |
#1 · Zasláno: 22. 8. 2009, 15:28:59
Dobrý den. CHci se zeptat. Mám stránku, kde je odkaz na otevření okna. Odkazem jsem vyvolal otevření viz:
function whisper(to_user,to_username) { txt = '<html><head>'; txt += '<scr'+'ipt>function fetch(){window.opener.showTextMini(mini_read,'+to_user+')};setInterval("fetch()",10000);setTimeout("fetch()",200);'; txt += 'function useSmile(sid){ a=mini_write.document.getElementById("text"); a.value=a.value+"!"+sid+"! "; a.focus(); }'; txt += '</scr'+'ipt>'; txt += '</head><body>'; txt += '<div id="mini_read">'; txt += '<div id="msgBoxMini"><span class="system">čekejte... nahrávám...</span></div>'; txt += '<input name="text" id="text" type="text">'; txt += '</div>'; txt += '</body></html>'; var win = window.open("","whisper"+to_user_ID, "width=500, height=300, menubar=0, status=1, resizable=1, scrollbars=1"); win.document.write(txt); win.document.close(); } v tom okně ze kterého jsem klikl na odkaz mám další js "showTextMini" function showTextMini(target,user_ID) { var txt = ''; var i_use = 0; var num_line = 20; var is_last = 0; var a = target.document.getElementById("msgBoxMini"); for(i=text_list.length-1;i>=0;i--) { var row = text_list[i]; if ((row.uid1!=user_ID && row.uid2!=user_ID) || !row.uid2){continue;}i_use++; if (i_use>=num_line) { is_last = 1; } txt += textFormatMini(row) + '<br>'; } a.scrollTop = 0; if (i_use==0) {txt += "<i>žádné texty</i>";}a.innerHTML = txt;} bohužel mi to var a píše jako undefined a nevím jak se dostat k tomu "msgBoxMini" z otevřeného okna. děkuji. |
||
_es Profil |
#2 · Zasláno: 22. 8. 2009, 17:42:09 · Upravil/a: _es
Jack06
Premenná win je lokálna premenná funkcie whisper a po skončení tej funkcie zaniká. Preto ak chceš, aby tá premenná existovala aj po skončení funkcie tak: var win; function whisper(/*parametre*/){ /* ... */ win = window.open(/*parametre*/); } var a = win.document.getElementById("msgBoxMini"); // Element s id msgBoxMini v otváranom okne |
||
Časová prodleva: 15 let
|
0