View Full Version : Activating functions from other functions?
03-16-2012, 02:49 AM
Is there a way to activate a function from another function? It has to be in the script tag, it can't be in the HTML section. Can I use something similar to this following code? If not, can anyone give me some help? I have tried to do it various ways, and have looked it up a few times, but to no avail. Can I use something similar to this following code? If not, can anyone give me some help?
Any help I can get would be appreciated. Thanks a lot to anyone who can help.
03-16-2012, 02:57 AM
03-16-2012, 03:04 AM
Does it work like this?
alert("Condition is true");
If not, I can change my code to something that works the same way, but either way, thanks a lot.
03-16-2012, 03:09 AM
That's how you do it if you want it to run straight away. If you want it to run as a response to an event then you'd attach it to the element in the HTML and the appropriate event handler using
document.getElementById('id_of_tag').oneventname = functionname;
(or if you want to make sure it doesn't clash with other processing attached to the same event then use an event listener instead)
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.