LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to run a function when a link is clicked (https://www.linuxquestions.org/questions/programming-9/how-to-run-a-function-when-a-link-is-clicked-671964/)

venkat@123 09-24-2008 12:39 AM

how to run a function when a link is clicked
 
Hi ...

I have a link now.. if i click on that link i need to run a function in the background.for that one i need to use a scripting language to connect between those two. can any body tell me how to connect using java script or any other scripting language...

theYinYeti 09-25-2008 09:06 AM

This could help you:
http://www.onlinetools.org/articles/...ivejavascript/

This is the author's site:
http://icant.co.uk/html/scripting.php

In short, if you're serious about web programming, not a single “onclick” should show in your HTML code; you should, from the HEAD of your document, place an event on the window object to make your script start after the page is loaded; the script will then place an event listener on the link node, for whatever action you want it to do.

Yves.

unihiekka 09-25-2008 09:11 AM

Be more specific. Do you mean a link in a web page (html, php, ...), a link between files, or something completely different?

theYinYeti 09-25-2008 09:16 AM

And if what you want is calling a server in Javascript in the background, your action should use the technique known as “ajax”.

Yves.


All times are GMT -5. The time now is 05:39 PM.