Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-01-2009
Member
 
Join Date: Dec 2008
Posts: 150
Retrieve a value with onclick

With onclick no problem to display text in a tag. I use this:

<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?
Reply With Quote
  #2  
Old 05-01-2009
Member
 
Join Date: May 2008
Posts: 1,180
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 ] ;
would be sufficient ...

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"
Reply With Quote
  #3  
Old 05-01-2009
Member
 
Join Date: Dec 2008
Posts: 150
Re: Retrieve a value with onclick

I tested:
onclick = "disp = $tab [name_action];
but I can not display the $ disp
Reply With Quote
  #4  
Old 05-01-2009
Member
 
Join Date: May 2008
Posts: 1,180
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! )
Reply With Quote
  #5  
Old 05-01-2009
Member
 
Join Date: Dec 2008
Posts: 150
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.
Reply With Quote
  #6  
Old 05-01-2009
Member
 
Join Date: May 2008
Posts: 1,180
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)
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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 04:45 PM
HTML/JavaScript/onclick KADEEM Software Development 4 03-11-2009 06:37 PM
Onclick and Firefox3 Coolestman Software Development 3 02-09-2008 02:46 PM


All times are GMT +5.5. The time now is 12:18 AM.