Problem with onload

Hi,

I would like some help with an issue I have. I have this chat, that is executing some initialising Javascript code in a

		function initialize() {			
			ajaxChat.updateButton('audio', 'audioButton');
			ajaxChat.updateButton('autoScroll', 'autoScrollButton');
			document.getElementById('bbCodeSetting').checked = ajaxChat.getSetting('bbCode');
			document.getElementById('bbCodeImagesSetting').checked = ajaxChat.getSetting('bbCodeImages');
			document.getElementById('bbCodeColorsSetting').checked = ajaxChat.getSetting('bbCodeColors');
			document.getElementById('hyperLinksSetting').checked = ajaxChat.getSetting('hyperLinks');
			document.getElementById('lineBreaksSetting').checked = ajaxChat.getSetting('lineBreaks');
			document.getElementById('emoticonsSetting').checked = ajaxChat.getSetting('emoticons');
			document.getElementById('autoFocusSetting').checked = ajaxChat.getSetting('autoFocus');
			document.getElementById('maxMessagesSetting').value = ajaxChat.getSetting('maxMessages');
			document.getElementById('wordWrapSetting').checked = ajaxChat.getSetting('wordWrap');
			document.getElementById('maxWordLengthSetting').value = ajaxChat.getSetting('maxWordLength');
			document.getElementById('dateFormatSetting').value = ajaxChat.getSetting('dateFormat');
			document.getElementById('persistFontColorSetting').checked = ajaxChat.getSetting('persistFontColor');
			for(var i=0; i<document.getElementById('audioVolumeSetting').options.length; i++) {
				if(document.getElementById('audioVolumeSetting').options[i].value == ajaxChat.getSetting('audioVolume')) {
					document.getElementById('audioVolumeSetting').options[i].selected = true;
					break;
				}
			}
			ajaxChat.fillSoundSelection('soundReceiveSetting', ajaxChat.getSetting('soundReceive'));
			ajaxChat.fillSoundSelection('soundSendSetting', ajaxChat.getSetting('soundSend'));
			ajaxChat.fillSoundSelection('soundEnterSetting', ajaxChat.getSetting('soundEnter'));
			ajaxChat.fillSoundSelection('soundLeaveSetting', ajaxChat.getSetting('soundLeave'));
			ajaxChat.fillSoundSelection('soundChatBotSetting', ajaxChat.getSetting('soundChatBot'));
			ajaxChat.fillSoundSelection('soundErrorSetting', ajaxChat.getSetting('soundError'));
			document.getElementById('blinkSetting').checked = ajaxChat.getSetting('blink');
			document.getElementById('blinkIntervalSetting').value = ajaxChat.getSetting('blinkInterval');
			document.getElementById('blinkIntervalNumberSetting').value = ajaxChat.getSetting('blinkIntervalNumber');
		}

		ajaxChatConfig.loginChannelID = parseInt('[LOGIN_CHANNEL_ID/]');
		ajaxChatConfig.sessionName = '[SESSION_NAME/]';
		ajaxChatConfig.cookieExpiration = parseInt('[COOKIE_EXPIRATION/]');
		ajaxChatConfig.cookiePath = '[COOKIE_PATH/]';
		ajaxChatConfig.cookieDomain = '[COOKIE_DOMAIN/]';
		ajaxChatConfig.cookieSecure = '[COOKIE_SECURE/]';
		ajaxChatConfig.chatBotName = decodeURIComponent('[CHAT_BOT_NAME/]');
		ajaxChatConfig.chatBotID = '[CHAT_BOT_ID/]';
		ajaxChatConfig.allowUserMessageDelete = parseInt('[ALLOW_USER_MESSAGE_DELETE/]');
		ajaxChatConfig.inactiveTimeout = parseInt('[INACTIVE_TIMEOUT/]');
		ajaxChatConfig.privateChannelDiff = parseInt('[PRIVATE_CHANNEL_DIFF/]');
		ajaxChatConfig.privateMessageDiff = parseInt('[PRIVATE_MESSAGE_DIFF/]');
		ajaxChatConfig.showChannelMessages = parseInt('[SHOW_CHANNEL_MESSAGES/]');
		ajaxChatConfig.messageTextMaxLength = parseInt('[MESSAGE_TEXT_MAX_LENGTH/]');
		ajaxChatConfig.socketServerEnabled = parseInt('[SOCKET_SERVER_ENABLED/]');
		ajaxChatConfig.socketServerHost = decodeURIComponent('[SOCKET_SERVER_HOST/]');
		ajaxChatConfig.socketServerPort = parseInt('[SOCKET_SERVER_PORT/]');
		ajaxChatConfig.socketServerChatID = parseInt('[SOCKET_SERVER_CHAT_ID/]');

		ajaxChat.init(ajaxChatConfig, ajaxChatLang, true, true, true, initialize);
      </script>
      <script type="text/javascript">
                   var dhxWins;
                   function doOnLoad() {
                         dhxWins = new dhtmlXWindows();
                         dhxWins.enableAutoViewport(false);
                         dhxWins.attachViewportTo("winVP");
                         dhxWins.setImagePath("dhtmlxWindows/codebase/imgs/");
                   }

                  var idPrefix = 1;
                  function createWindow() {
                         var p = 0;
                         dhxWins.forEachWindow(function() {
                                  p++;
                         });
                        if (p > 100) {
                            alert("Too many windows");
                            return;
                         }
                        var id = "userWin" + (idPrefix++);
//;
                        var w = Number(document.getElementById("win_w").value);
                        var h = Number(document.getElementById("win_h").value);
                        var x = Number(document.getElementById("win_x").value);
                        var y = Number(document.getElementById("win_y").value);
//;
                        dhxWins.createWindow(id, x, y, w, h);
                        dhxWins.window(id).setText(document.getElementById("win_t").value);
//;
                        document.getElementById("win_x").value = x + 8;
                        document.getElementById("win_y").value = y + 6;
                  }

      </script>

Hi,

check that doOnLoad function doesn’t throw errors. For example, there is dhxWins.attachViewportTo(“winVP”) call and no div with “winVP” id. Here is the working sample for attachViewportTo method:

dhtmlxWindows/samples/02_viewports/03_render_as.html

i didn’t post the entire code, just the crucial parts. there is, actually, a winvp

. :slight_smile:

In that case, please, make a complete demo and attach it…

@e_c:
Check the case of your variables. I’ve been bitten by that on occasion, and sometimes they’re easy to miss. For example, “winVP” vs “winVp” and so on. I thought of that as I read your posts, and noticed you spelled it “winVP” in one post, and “winvp” in another. Just a thought… :slight_smile: