supertsel
01-29-2009, 11:19 AM
1) Script Title: DHTML Window Widget
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/
3) Describe problem:
hi,thanks for the fantastic script, it works really fine for one window.
I'm able to create a mini-chat function with one user using AJAX, but when I try to do it with a second window, I can't update the second DIV correctly, as using the parent.document.getElementByID only targets the first window.
How can I target the DIVs of multiple DHTML widget windows?
I'm creating two windows, assigning each a different 'uniquevar' using $chatid (which is a 9-digit number) through PHP:
<--- HTML CODE that launches the DHTML widget window--->
ajaxwin<?php echo $chatid; ?>=dhtmlwindow.open('win'+ <?php echo $chatid; ?> +'', 'ajax', 'messenger.php?id=' + <?php echo $row_onlineusers['friendid']; ?> + '&cookiechat=' + <?php echo $chatid; ?>+'','Messenger', 'width=318px,height=250px,left=400+<?php echo $row_onlineusers['friendid']; ?>+10,top=<?php echo $row_onlineusers['friendid']; ?>px')"
<---HTML CODE of the widget window --->
<input type="text" onKeyDown="if(event.keyCode==13) sendChatText(<?php echo $_GET['cookiechat']; ?>);" id="txt_message" name="txt_message" style="width: 190px;">
<---- JS CODE which resides in dhtmlwindow.js as the widget is created from a php include---->
function getChatText(cookie_id) {
receiveReq.open("GET", 'getChat.php?chat=1&chat_id='+ cookie_id +'&last=' + lastMessage, false);
receiveReq.send(null);
var ajaxwindow = 'ajaxwin'+cookie_id;
ajaxwindow.document.getElementById('div_chat').innerHTML = receiveReq.responseText;
}
IE & FF return the error 'ajaxwindow is undefined'. I guess I'm not targeting the DIV 'div_chat' correctly?
Thanks for your help
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/
3) Describe problem:
hi,thanks for the fantastic script, it works really fine for one window.
I'm able to create a mini-chat function with one user using AJAX, but when I try to do it with a second window, I can't update the second DIV correctly, as using the parent.document.getElementByID only targets the first window.
How can I target the DIVs of multiple DHTML widget windows?
I'm creating two windows, assigning each a different 'uniquevar' using $chatid (which is a 9-digit number) through PHP:
<--- HTML CODE that launches the DHTML widget window--->
ajaxwin<?php echo $chatid; ?>=dhtmlwindow.open('win'+ <?php echo $chatid; ?> +'', 'ajax', 'messenger.php?id=' + <?php echo $row_onlineusers['friendid']; ?> + '&cookiechat=' + <?php echo $chatid; ?>+'','Messenger', 'width=318px,height=250px,left=400+<?php echo $row_onlineusers['friendid']; ?>+10,top=<?php echo $row_onlineusers['friendid']; ?>px')"
<---HTML CODE of the widget window --->
<input type="text" onKeyDown="if(event.keyCode==13) sendChatText(<?php echo $_GET['cookiechat']; ?>);" id="txt_message" name="txt_message" style="width: 190px;">
<---- JS CODE which resides in dhtmlwindow.js as the widget is created from a php include---->
function getChatText(cookie_id) {
receiveReq.open("GET", 'getChat.php?chat=1&chat_id='+ cookie_id +'&last=' + lastMessage, false);
receiveReq.send(null);
var ajaxwindow = 'ajaxwin'+cookie_id;
ajaxwindow.document.getElementById('div_chat').innerHTML = receiveReq.responseText;
}
IE & FF return the error 'ajaxwindow is undefined'. I guess I'm not targeting the DIV 'div_chat' correctly?
Thanks for your help