Solved

Javascript object onClick reference another object's onclick

Posted on 2007-12-05
3
1,667 Views
Last Modified: 2012-05-05
In Java script, when I click on an object, it calls a function. But I actually need to run the function of another object because it passes the 'this' property of the object (I believe it's a DIV if that matters. So, when I click on object A, can I call object B's event?

ObjectA onClick=(ObjectB(onmouseup="DoSomething(this)")

Can I do that? Or, how can I get the 'this' of objectB to objectA's event?

Thanks in advance
0
Comment
Question by:niner
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
raj3060 earned 125 total points
ID: 20412065
Yes you can call Object B event from Object A by using document.getElementById('ObjectBid')
0
 

Author Comment

by:niner
ID: 20412321
Cool bean. Then, how do I call the function?

0
 
LVL 11

Expert Comment

by:raj3060
ID: 20412420
DoSomething(document.getElementById('ObjectBid').value)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now