Page 1 of 1

image + javascript

Posted: Sun Mar 23, 2003 5:12 am
by Guy
how can I add JavaScript to png image I'm creating.
I want to add onmouseover and onclick to the picture
Thanks
Guy

Posted: Sun Mar 23, 2003 5:14 am
by twigletmac
I've moved this to the Client Side forum which is where questions about JavaScript should go.

Mac

Posted: Sun Mar 23, 2003 8:10 am
by Gen-ik
Are you creating the code dynamically??

If you are you can just do this in PHP..

Code: Select all

<?php
echo("<img src='img.png' width=100 height=100 onmouseover='do something' onclick='do something else'>");
?>
..if you want to dynamically add the onmouseover and onclick actions do this..

Code: Select all

<?php
$mouseover="do something";
$click="do something else";

echo("<img src='img.png' width=100 height=100 onmouseover='$mouseover' onclick='$click'>");
?>
..if the code is hard-wired just use this..

Code: Select all

&lt;img src='img.png' width=100 height=100 onmouseover='do something' onclick='do something else'&gt;
..if none of that helps then try to add a bit more detail to your question!