Dragen Posted November 20, 2007 Share Posted November 20, 2007 Hi, I'm quite new to javascript, although I can write a very basic script. I'm not new to scripting though, just more fluent in php. If I have an image, can I get javascript to do an onclick to check what colour in the image the user has clicked on? For example; If I had the following image: I want to be able to check what colour selection the user has made. I think I can check the click location against an array of variables for each colour (although I'm not quite sure how..), but I don't want to have to create a large array for each colour. Instead I want to get the colour that is clicked, wherever it is, so that if the image is changed at some point, and the colours are moved, then it still works. Sorry about the long explanation. Hopefully someone can help. Thanks Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted November 21, 2007 Share Posted November 21, 2007 where do you want the results of the color to be displayed or sent to? do you want it to be set as a form value or to display in the page or to be sent in a string or etc.? Quote Link to comment Share on other sites More sharing options...
Dragen Posted November 21, 2007 Author Share Posted November 21, 2007 Thanks for the reply, but I've actually solved it late last night. To see how I did it follow this link to my post in the ajax forum: http://www.phpfreaks.com/forums/index.php/topic,168509.msg743102.html#msg743102 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.