PDA

View Full Version : About event for class


anandraj
10-24-2002, 04:18 PM
Hi All,
I have written a common function for particular class like clMenu as below
<script for=clAnmenu event=onmousedown() language=javascript">
return MDown(this)
</script>
This is working fine for all Anchor Tags with name as clAnmenu.
I have tried the same thing for <td> but not working.
Will this work for only anchor tags How to simulate the same thing for any tags. Is it possible?

Thanks and Regards
Anandraj

beetle
10-24-2002, 05:23 PM
Yes, there are other ways to achieve that. Besides, named scripts only work in IE

How many tables to you need to affect?

anandraj
10-25-2002, 06:43 AM
Hi
I have some 7 rows like below. On each TD i have to write OnMouseOver. Instead of this i want to write a single event handler like
<script name=clname even=onmouseover()......
I have tried that It is working only for Anchor tag. How to simulate the same for TD or any other Tags.

<tr height=15>
<td width=12 name=clBGcolor onmouseover=MOver(this) bgcolor=#FFFFFF id=c37></td>
<td width=12 name=clBGcolor onmouseover=MOver(this) bgcolor=#CCCCCC id=c38></td>
<td width=12 name=clBGcolor onmouseover=MOver(this) bgcolor=#999999 id=c39></td>
<td width=12 name=clBGcolor onmouseover=MOver(this) bgcolor=#666666 id=c40 ></td>
<td width=12 name=clBGcolor onmouseover=MOver(this) bgcolor=#333333 id=c41></td>
<td width=12 name=clBGcolor onmouseover=MOver(this) bgcolor=#000000 id=c42></td>
</tr>

Thanks
Anand

beetle
10-25-2002, 06:50 AM
Well, the onMouseOver event 'bubbles', so you can listen for it on the table...or the whole document if you wishfunction MOver(e) {
var td = (document.all) ? e.srcElement : e.target;
if (td.nodeName != "TD") return;
/*
Do whatever you'd like here, the table cell that fired the event has been captured and referenced with our td variable
*/
}

<body onMouseOver="MOver(event)">

// or

<table onMouseOver="MOver(event)">

// to affect just one table...