473,406 Members | 2,956 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,406 software developers and data experts.

Can I call a function in a onclick event?

chelvan
90
hi
its me again

is it possible to calling a function in < a > onclick event?



thanks in advance
chel-1
Sep 8 '08 #1
10 3913
r035198x
13,262 8TB
You could test it and tell us if it's possible ...
Sep 8 '08 #2
bnashenas1984
258 100+
Wasn't it easier to test if it'e possible or not instead of waiting for answer from us?
btw, Yes it's possible.
Sep 8 '08 #3
Atli
5,058 Expert 4TB
is it possible to calling a function in < a > onclick event?
You can execute any client-side script in an event like that.
Unless you are trying to execute a PHP function?

I would have to agree with the others tho... it should only take you like a minute to test that yourself.

Btw, I changed the thread title. Please try to make your titles descriptive. Simply stating something like "onclick" isn't really helpful.

Check out the Posting Guidelines to see what makes a good thread title.

MODERATOR
Sep 8 '08 #4
Markus
6,050 Expert 4TB
As Atli said: you can run client side functions easily with an onclick event. However, you posted this in the PHP forum, so I'm a little sketchy as to your question. PHP or Javascript?
Sep 9 '08 #5
chelvan
90
As Atli said: you can run client side functions easily with an onclick event. However, you posted this in the PHP forum, so I'm a little sketchy as to your question. PHP or Javascript?
yes sir
my question is on php.

chel-1
Sep 10 '08 #6
Atli
5,058 Expert 4TB
You can't call server-side code from within client-side code.
The only way to do that would be to either completely reload the page or use AJAX.
Sep 10 '08 #7
bnashenas1984
258 100+
Hi
The other option is to have a hidden IFRAME and refresh it with a java script.
It wont be hard
Sep 10 '08 #8
bnashenas1984
258 100+
Here's how you can do it:

Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script type="text/javascript" >
  3.     function refresh()
  4.     {
  5.         frames['myframe'].location.reload();
  6.     }
  7. </script>
  8.  
  9. </head>
  10.  
  11. <body>
  12. <a onclick="refresh();">Click me</a>
  13. <iframe name="myframe" id="myframe" frameborder="0" src="funcContainer.php" width="50" height="50" style="display:none"></iframe><br />
  14. </body>
  15.  
  16.  
  17.  
When you click on the link the IFRAME refreshes the page which is funcContainer.php

But if you use this code you wont see the ifram. If you want to make sure this code works delete (style="display:none") from the IFRAME tag.

Good luck
Sep 10 '08 #9
chelvan
90
thanks forum.

i try & do it with ur guides.


thanks a lot
chel-1
Sep 11 '08 #10
This worked really good!!
Oct 23 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
2
by: abs | last post by:
Hi all. Is that possible to call the onclick, onchange or other event from JS ? I mean how to make the browser think that user clicked the element (onclick event) ? Eg. I have <element...
5
by: Anand Ganesh | last post by:
Hi All, I need some help. I am sort of not sure how to approach this problem. I have a MAINPROGRAM. This is the core application. I have asked two of my staff to developed two different...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
7
by: Bonzo | last post by:
>From within a function, I want to pass a/some parameters to another function, AND all arguments, passed into this function. e.g. function firstFunction(){ //this function may have been...
18
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe. ...
1
by: finerrecliner | last post by:
what i'm trying to accomplish: user clicks button. then can click 2 more times anywhere on the page and display his mouse coordinates. after those 2 clicks, go back to normal mouse behavior the...
1
by: saiyen | last post by:
Hey all, ive been banging my head agains the wall for a few days now, and finally decided to ask for help. i have a document that writes the header with all the javascript in it, then modifyes a...
2
by: Miroslav Stampar [MCSD.NET / Security+] | last post by:
Does anybody have an idea how to call CGI on a onclick event when link is clicked. This is a sample that works in some situations but sometimes new page loading is to fast. <a...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.