[thelist] Two events calling almost identical functions

Chris Price chris.price at choctaw.co.uk
Thu Oct 25 19:10:08 CDT 2007

I hope this makes sense. It follows on from a post I sent a while ago 
which got me up and running but I'm left with duplicate coding.

I have built an associative array (MyComp) and am calling the mouseover 
function as follows:

for (i in MyComp) {
        var MyBall = document.getElementById(i)
        MyBall.desc = MyComp[i];
        MyBall.onclick = start6ball;
        MyBall.onmouseover = mouseover;

In mouseover() I recall the array with this.desc

I have the start6ball function because I don't want mouseover to work 
until an element has been clicked. But when they do click an element I 
want the effect to be the same as for mouseover. The only difference 
between the 2 functions is that start6ball changes a global variable to 
1 which allows mouseover to work. The ideal is for start6ball to just be 
a switch but if I call mouseover from within start6ball then this.desc 
has no value.

Kind Regards
Chris Price


chris.price at choctaw.co.uk

Tel. 01524 825 245
Mob. 0777 451 4488

Beauty is in the Eye of the Beholder
while Excellence is in the Hand of the Professional

-+- Sent on behalf of Choctaw Media Ltd -+-

Choctaw Media Limited is a company
registered in England and Wales
with company number 04627649

Registered Office:
Lonsdale Partners,
Priory Close,
St Mary's Gate,
Lancaster LA1 1XB
United Kingdom

More information about the thelist mailing list