[thelist] [JavaScript] event location issue restated

Dan Parry dan at virtuawebtech.co.uk
Wed Feb 22 09:59:12 CST 2006


Personally I would add the events at load time

Firstly it would cut the size of the site (albeit marginally; it all helps)

Secondly I hardly imagine that this would cause a load problem for the
application as a whole... I have a piece of code that does similar but also
instantiates a load of objects and does some fiddly stuff with the DOM
onload (it's quite a big script... much bigger than I would have liked) and
the load on the client machine is negligible (not enough even to be noticed)

As you say it's far more maintainable... this is a Good Thing(tm) :)...
nothing worse than having to hunt down 40-50 onclicks (or even add them...
especially if you make loads of typos like I do... had a great time
debugging a script that wouldn't fire an onclick until I noticed I'd typed
onlick instead... something Freudian maybe?)

Well that's my opinion anyway :)

HTH

Dan

-----------------------------------------------------
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Tom Dell'Aringa
Sent: 22 February 2006 15:40
To: thelist
Subject: [thelist] [JavaScript] event location issue restated

Let me restate my earlier question. I have a page on this application of
some 40-50 pages that has
inline event handler calls like onclick=func(). I prefer to do things
unobtrusively.

So, I can add this line in my main js file:

addBodyOnload(myFunc);

And add the events at load time. The problem is, this code will execute on
40-50 pages. So is the
tradeoff worth it to add it to the onload queue? Or does it make more sense
to leave it inline...
maintenance wise its better unobtrusive.

I have at least 3-5 more cases just like this I have to deal with. I want to
do things cleanly,
but I don't want to bog down the application either...

Tom

http://www.pixelmech.com/
http://www.crossandthrone.com/


Professor Rumford: 'But I still don't understand about hyperspace.' 
The Doctor: 'Well, who does?' 
K9: 'I do.' 
Doctor: 'Shut up, K9!' 


-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 




More information about the thelist mailing list