Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-24-2008, 12:39 AM   #1
LQ Newbie
Registered: Aug 2008
Posts: 2

Rep: Reputation: 0
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...
Old 09-25-2008, 09:06 AM   #2
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 63
This could help you:

This is the author's site:

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.

Old 09-25-2008, 09:11 AM   #3
Registered: Aug 2005
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273

Rep: Reputation: 32
Be more specific. Do you mean a link in a web page (html, php, ...), a link between files, or something completely different?
Old 09-25-2008, 09:16 AM   #4
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

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



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Switch to firefox when link is clicked krazytekn0 Ubuntu 2 07-29-2007 08:02 AM
kmail freezing when html link is clicked mrapathy Slackware 2 10-31-2006 06:15 PM
How do I run a function within a function arguement? C/C++ RHLinuxGUY Programming 12 05-19-2006 02:29 PM
Which function at link layer sends packet? cranium2004 Linux - Networking 0 02-03-2005 07:06 AM
Updating MySQL DB when a link is clicked with PHP Erik Thorsson Programming 2 12-03-2004 07:35 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration