|
| ||||||||||
| Tags: onclick, retrieve, value |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Retrieve a value with onclick
<img src="image.png" onclick="document.getElementById('disp').setTextValue('$tab[name_action]');"> and it appears there: <span id="disp"> </ span> But I would like to get the result without a tag and can display it in my document php. I try to create a variable: onclick="var disp = document.getElementById('disp').setTextValue('$tab[name_action]');" but I can not see the result. Do you have any idea? |
|
#2
| ||||
| ||||
| Re: Retrieve a value with onclick
Already there, in your var disp, you will at most result of the function. setTextValue () (just what framework elsewhere? .. Because I was not a standard JS!) A simple Code: Code: var disp = $tab [ name_action ] ; Secondly, I think that even if you ASSIGNED your variable in this way, its visibility will be limited to the management of the event ... In fact, "var" locates the variable block of code in which it is declared. To make global and thus usable simply turn the "var" |
|
#3
| |||
| |||
| Re: Retrieve a value with onclick
I tested: onclick = "disp = $tab [name_action]; but I can not display the $ disp |
|
#4
| ||||
| ||||
| Re: Retrieve a value with onclick
Display where? When? How? ... Then, do not mix: $disp with existing JavaScript. This '$' in me have some suspicions: you do not want to get that value on the server side by chance? (And I still do not know what framework you use ... because, I repeat, setTextValue () is not a standard JS! .. I have an idea of the answer .. but I want to be sure you know what you manipulate! ) |
|
#5
| |||
| |||
| Re: Retrieve a value with onclick
I want to make an application facebook, when you click on an image I want to get the id of the image to insert a tag that does not code tags, I do not know how to explain it more simply. In any case thank you for your help. |
|
#6
| ||||
| ||||
| Re: Retrieve a value with onclick
In fact, you want that, one way or another, information such as what "the user has clicked on the image "XYZ" is registered "some part" in the end, I guess, and send this information on the server side to be dealt with ... But I guess that you do not want to reload the page and therefore you do not want to submit the information immediately in a way "classic" (a simple form) |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Retrieve a value with onclick" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| IE7 href + onclick - both happen | Ucchal | Software Development | 5 | 24-05-2010 03:58 PM |
| CSS Button onclick event href="#" onclick=" | Cornnelius | Software Development | 6 | 14-05-2010 11:20 PM |
| Onclick event with DIV tag | ISAIAH | Software Development | 5 | 03-03-2010 03:45 PM |
| HTML/JavaScript/onclick | KADEEM | Software Development | 4 | 03-11-2009 05:37 PM |
| Onclick and Firefox3 | Coolestman | Software Development | 3 | 02-09-2008 02:46 PM |