View Full Version : Help with "self.focus"

02-21-2006, 09:45 PM
Is there anyway to modify the code below with an OnChange="self.focus" tag?

<title>BYRD CHAT</title>

<body bgcolor="#000000" topmargin="0" leftmargin="0">

<!-- Start of Freechatcode Script -->
<form name="freechatform">
<input type="hidden" name="lg" value="">
<input type="hidden" name="cnm" value="thebyrdfamily">
<input type="hidden" name="wm" value="Welcome%20to%20Byrd%20Chat">
<input type="hidden" name="bg" value="000000">
<input type="hidden" name="fg" value="ffffff">
<input type="hidden" name="bw" value="">
<input type="hidden" name="sh" value="0">
<script language="JavaScript"
<!-- End of Freechatcode Script -->

All of this code will open in an independant window (SEE HERE (http://thebyrdfamily.home.comcast.net/chat2.htm)), and anytime a new message comes up from the chat, I want the window to move to the front. I have tried changing the body tag to <BODY OnBlur="self.focus"> but it prevents you from using another window AND it renders the chat window unusable.

02-21-2006, 09:56 PM
I doubt that's easy to do, and it would be highly annoying if the chat is very active but the chatter is doing somehting else for a moment.

You'd have to go through what the chat-script generates on the page. (In this case an I-Frame.) I don't know what the contents of that frame are but maybe you could do a simple check say every 5th second to see if the source of that frame is the same as it was 5 seconds ago. Since the page probably keeps reloading to update the chat, it's not easy to attach any event handlers and keep them there. They'd all be destroyed each time it i reloaded.

02-21-2006, 10:03 PM
I figured it would have to be on the code associated with the chat itself:( . Never hurts to ask though.

02-23-2006, 08:38 PM
Is there a way to have a popup window self.focus when there is a sound? The new chat room I have added to my site will make a sound when a user leaves a message.