Gene,
I am not familiar with Ben Forta's DHTML menus, but I am almost positive
that Ben is overloading the document onload event in his script and you are
short-circuiting this by specifying the onLoad event handler inside the body
tag.

Solutions:
Microsoft has addressed this issue with new features in IE 5 such as the
attachEvent method, behaviors, and event bubbling (See
http://msdn.microsoft.com/workshop/c-frame.htm?/workshop/author/Default.asp
for a complete reference).  Unfortunately these are not implemented in older
versions of IE or other browsers.

But we can still achieve these goals in the cross browser environment
through a little bit more scripting.  What I have done in large applications
with many functions needing to be binded to an event is to build an array of
handlers for any particular event.

This bit of code demonstrates this technique:

/* Declare the onLoadHandlers array to be loop through on the event
*/
var onLoadHandlers = new Array();

/* Tie this function to the onload attribute of the body tag
*/
function onLoadHandler(){
  for (x=0;x<onLoadHandlers.length;x++){
    eval(onLoadHandlers[x]+"()");
  }
}

/*
This function will appended a function to the onLoadHandlers array.
Call this function to attach all event hanlder functions to the onLoad event
i.e.. addOnLoadEvent("myOnloadFunction");
Where myOnloadFunction is the name of the function you are attaching to the
onLoad event.
*/
function addOnLoadEvent(sFunction){
  onLoadHandlers[onLoadHandlers.length] = sFunction;
}

/*
Now we need to overload the event handler for our custom script
*/
window.document.onload = onLoadHandler;


That may be a bit complicated to be used in your case, so here is a simpler
solution for the problem.

Open Ben Forta's DHML files and do a search for the keyword "onload".  You
will be looking for something similar to this statement:
window.document.onload = initDHTMLMenus;
What we want is the name of Ben's initialization function for the menus.

After you find this append the function to your onLoad attribute of the Body
tag.
<BODY
onLoad="window.document.TransactionForm.DateTransacted.focus();initDHTMLMenu
s();">

That will expose his initialization function to the documents onload event.

Hope this helps!

Good Luck,

Brett Suwyn
mailto:[EMAIL PROTECTED]




> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 25, 2000 4:36 PM
> To: [EMAIL PROTECTED]
> Subject: Ben's CF DHTML menus
>
>
> Anyone have any idea why Ben Forta's DHTML menus refuse to
> display  if I add an
> "onLoad" eventhandler to the page's body tag?
>
> Here's what kills the menus:
>
> <BODY onLoad="window.document.TransactionForm.DateTransacted.focus()">
>
> Can't figger it out...
>
> Gene Kraybill

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to