Beginner question on Javascript link in PHP
Don't beat me up too much, as I am brand new. We have added images in our index.php, which are called via the following command - all works fine and they link fine. The problem is that the mouse does not change to notify the users that these images are clickable. What are we missing here? Anything else, the mouse changes to the little pointing finger, but not on these calls. Example;
<img onClick="javascript:goToMilitia();" src="http://xxx.xxxxxx.xxx/images/mmenu/button9.png" /><br />
Thanks in advance!
teammatt3 posted this at 17:29 — 5th June 2009.
He has: 2,102 posts
Joined: Sep 2003
You can use CSS to change the cursor to the hand:
img {
cursor:pointer;
}
But the problem with that is every image will have the pointer (which you probably don't want).
Instead you can add a class to your image tag, and use a CSS selector to modify only the images with that class.
Adding the class to your tag:
<img class="clickable" onClick="javascript:goToMilitia();" src="http://xxx.xxxxxx.xxx/images/mmenu/button9.png" /><br />
And your CSS:
img.clickable {
cursor:pointer;
}
webwiz posted this at 17:41 — 5th June 2009.
He has: 629 posts
Joined: May 2007
Better yet, put a real link around the image and scrap the JavaScript. This will do everything you need on all computers, not just those with JavaScript enabled. (Google will find the link, too.)
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.