> There are a few DHTML widgets and they are not working
> properly in FF.
> For example the following is some of the code behind one
> DHTML widget:

> document.onmouseover = ItemOver;


> var eOld = null;

> function ItemOver()
> {
>  var eSrc = window.event.srcElement;
>  if (eSrc != null && eSrc.className == "item-b")
>  {
>    eSrc.className = "item-b2";
>  }
> }

> // this one complains about window.event has no properties

This wouldn't necessarily be a bad way to handle this task _if_
srcElement were a DOM standard property of the event object... The
event object itself is part of the DOM, so that's okay. Though it
would be much better to include a similar function in the onMouseOver
event-handler for each item of class "item-b" on your page...

function ItemOver(item) { item.className = 'item-b2'; }

then in your elements <div class="item-b"
onmouseover="ItemOver(this);" />

Unfortunately it doesn't look as though there is a DOM standard syntax
that would really be comparable to your original script. Although in
general looking at the script I have to think to myself "and you want
to do this why?" ... It's designed to change the class-name of objects
once they've been moused-over, but without changing them back on a
mouseout event? ... just seems odd...


> function setItem(eSrc, eNo, eExtern)
> {
>    eOld = eSrc;

>    if (eNo == 1)
>       eOld.className = "item-b1";
>    else
>      eOld.className = "item-b4";

>   var eTxt = eval("txt" + eOld.id);
>  eTxt.style.display = "";
> }
> // the eSrc is item1 and it complains during the eval
> function:
> txtitem1 is not defined

> what will be the equivalent of window.event in DOM2 event
> model?

This one's reasonably easy... You have to have an element on the page
with the ID (or possibly name) attribute of 'txtitem1' and then you
can replace var eTxt = eval("txt"+eOld.id); with var eTxt =
document.getElementById("txt" + eOld.id);

I would also recommend adding in the {} braces ... I understand that
the code works currently without them but, the less consistent
demarkation your code has (missing {}, missing ; at the end of a
line), the more potential there is for the code to produce undesirable
behavior, whether that's an error or something else.


s. isaac dealey     954.927.5117
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.sys-con.com/story/?storyid=44477&DE=1
http://www.sys-con.com/story/?storyid=45569&DE=1
http://www.fusiontap.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187301
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to