How can I send back an argumet with "onClick"?
<a href=test.php onClick="checkLink ('Gallon')" > 1 Gallon</a>
function checkLink(a)
{
return (a+3)
}
When the user click on the word "Gallon"
I want the value "Gallon" to go to session_var 2 14786
You can't do that directly. You'll have to call a PHP script for that,
somehow or another.. (or use cookies instead, but thats pretty
complecated and might not help you that much)
You might wanna do the following for example:
<a href=# onClick="checkLink('Gallon');" > 1 Gallon</a>
function checkLink(s) {
location.href='test.php?checklink='+escape(s);
}
This will send checklink as parameter to test.php. Now in PHP you can
retrieve that values by getting get get values... depending on your PHP
configuration either the variable $checklink exists or you'll have to do
with with the (I thought, but I'm not totally sure) $_GET['checklink']
variable.
There are serveral other solutions. For example, you could open a popup
window, and process the value there, or you could build a forward
page... like:
location.href='forward.php?checklink='
+escape(s)+'&link='+unescape(link);
forward.php would then first process the value of checklink and then
forward to $link (see HTTP response codes, and the PHP header() function)
Good luck,
Vincent
In article <20***************************@mb-m28.aol.com>, ga*****@aol.com enlightened us with... How can I send back an argumet with "onClick"?
You assign the return value to a variable.
onClick="var a=checkLink('Gallon');" <a href=test.php onClick="checkLink ('Gallon')" > 1 Gallon</a> function checkLink(a) { return (a+3) } When the user click on the word "Gallon" I want the value "Gallon" to go to session_var
If that's a real session variable, you can't do that. Session variables
are interpreted on the server. Javascript runs on the client. By the
time the JS runs, the server is done processing the request and has sent
it to the client.
--
--
~kaeli~
Punctuation, capitalization, and grammar are your friends,
and will help people think that you aren't such an ignorant
moron, after all. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Patrice |
last post by:
Hi,
I'm trying to use a javascript function passing a vb variable. I don't
understand why it doesn't work.
Can someone help me?
Thanks in advance.
Here is my javascript function used to...
|
by: Pavils Jurjans |
last post by:
Hallo,
I have been programming for restricted environments where Internet Explorer
is a standard, so I haven't stumbled upon this problem until now, when I
need to write a DOM-compatible code.
...
|
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: grandeandy |
last post by:
question: in the code below, and in general, how would I input multiple
functions into the code, and get multiple outputs? basically, I want to
be able to add say 2 or 3 of the div's to the link so...
|
by: Guest |
last post by:
I'm working with a .hta file that uses javascript to produce 3checkboxes. If any checkbox is checked, a corresponding text boxappears. I'd like to be able to pass the data entered in thetext boxes to...
|
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...
|
by: Csaba Gabor |
last post by:
Inside a function, I'd like to know the call stack. By this I mean
that I'd like to know the function that called this one, that one's
caller and so on.
So I thought to do:
<script...
|
by: johnjsforum |
last post by:
Buddies,
I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function
////////////////////////////////////////////////////////////////////////////////////...
|
by: Csanád |
last post by:
Hi,
Here's my form:
http://www.steinrogan.com/SecureSite_v2_beta/addthis.php
When I add two or more Dependant Items and remove one that's not the last that I added, I won't be able to remove...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |