Is there a way possible to put an image name in a variable when you put your mouse over it ? or anything else.. such as text..
like: [IMAGE] <-- when you put your mouse over it.. the code will..
$image = imagename.gif;
because [IMAGE] is a random image everytime.. any help would be appreciated.
PHP onmouseover get image name.. ?
Moderator: General Moderators
What should happen is:
onmouseover: get (image name), set ($image = "image name";)
(the image is always somewhat random so i never know what its gonna be)
basically all i need is something like:
onmouseover: get (image name), set ($image = "image name";)
(the image is always somewhat random so i never know what its gonna be)
basically all i need is something like:
or<?
onmouseover:getsource(eg; whatever.gif);
$image = "thatsource";
?>
<?
$image = onmouseover:getsource
?>
The people in the Client-Side forum should know how to handle this one.
You're going to have to set up a javascript function that is triggered by the onMouseOver.
Something like <a href="#" onMouseOver="function();">
PHP is server side, and JavaScript is client side, so there's no way for the two to interact with each other.
You're going to have to set up a javascript function that is triggered by the onMouseOver.
Something like <a href="#" onMouseOver="function();">
PHP is server side, and JavaScript is client side, so there's no way for the two to interact with each other.
This should work:
This will store the src of the image in the hidden variable. You can then submit this form, sending the image name.
There is no way to dynamically set PHP values using a mouseover - you need to somehow submit data to the PHP page to get the data sent.
Just curious - if this page is a PHP page, why do you need to send the image src to the file? Isn't PHP what dynamically generates the image src anyway?
Code: Select all
function send_image_name(passed_object)
{
document.getElementById('variable_to_store_in') = passed_object.src;
}Code: Select all
<body>
<form>
<input type = 'hidden' id = 'variable_to_store_in'>
<img src = "e;random.gif"e; onMouseOver = "e;send_image_name(this);"e;>
<input type = 'submit'>
</form>
</body>This will store the src of the image in the hidden variable. You can then submit this form, sending the image name.
There is no way to dynamically set PHP values using a mouseover - you need to somehow submit data to the PHP page to get the data sent.
Just curious - if this page is a PHP page, why do you need to send the image src to the file? Isn't PHP what dynamically generates the image src anyway?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.