473,320 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Assiging actions dynamically

I am parsing some elements of an HTML document to add onmouseover and
onmouseout actions to them dynamically. However, if they already have
actions, I want to include them those as well...

I can get the code inside the applied mouseover function with something
like:

if(typeof(obj.onmouseover)=='function'){
// make the function definition a string.
funcOverDefn = "" + obj.onmouseover;

// find the positions of the openeing and closing
// curly braces
firstBrace = funcOverDefn.indexOf('{');
lastBrace = funcOverDefn.lastIndexOf('}');

// get everything between the braces
funcOverDefn=funcOverDefn.substring(firstBrace+1,l astBrace);
}

Then if the element needs something applied (for instance, changing the
display style), I use:

obj.onmouseover=function(){
// display the child element
this.lastChild.style.display="block";
}

However, I want to also apply the code found in the previously found
funcOverDefn variable. Can this be accomplished?

Any pointers/references greatly appreciated.

TIA

--
Justin Koivisto - ju****@koivi.com
http://koivi.com
Jul 23 '05 #1
2 1192
I think this will work for you, but just try it. For each function your
want on your mouse over, you can assign an event to it.

obj.attachEvent("onmouseover",nameofyourfunction1) ;

obj.attachEvent("onmouseover",nameofyourfunction2) ;

Jul 23 '05 #2
ke************@gmail.com wrote:
I think this will work for you, but just try it. For each function your
want on your mouse over, you can assign an event to it.

obj.attachEvent("onmouseover",nameofyourfunction1) ;

obj.attachEvent("onmouseover",nameofyourfunction2) ;


I should have waited a little before posting...

I just stored the old function in a new property, and used the new one
to call it:

obj.oldonmouseover = obj.onmouseover;
obj.onmouseover=function(evt){
if(this.oldonmouseover){
this.oldonmouseover(evt);
}
this.lastChild.style.display="block";
}

Seems like it never fails, post a message and find a way to do it... ;)

I did try the addEventListener, but that didn't work, then I realized I
could do this instead.

Thanks

--
Justin Koivisto - ju****@koivi.com
http://koivi.com
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Kay Schluehr | last post by:
Hi all, thanks for Your attention ! I think my proposal was more in mind of Rons modified exec than Pythons lambda. When George proposed his unpacking behavoir for list-comps as a pack of...
1
by: ammarton | last post by:
Hello all...I'm a bit new to working with Macros in Access so forgive me if the terminology I use is not accurate. To preface this, basically I am using a form on a replicated database so the...
0
by: snuffie_456 | last post by:
Hello, I'm trying to describe a User Interface in XML. Purpose is to parse this file with Xerces and then show it as an Java-user interface (reason: portability). The description of the...
1
by: sandeepk84 | last post by:
hi all... does anyone know how v can commit d db actions performed using C#.. for eg. if i have created a table dynamically the database is 2 b refreshed to see it..can v commit by using d code???...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.