image + javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

image + javascript

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

I've moved this to the Client Side forum which is where questions about JavaScript should go.

Mac
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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!
Post Reply