Go Back   Pligg CMS Forum > Other > Off-topic

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-14-2007, 02:36 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 575
Thanks: 14
Thanked 126 Times in 61 Posts
Partially disabling onclick?

This is a small problem that I can't think of a solution for. I have a section of code like this:

<li id="this1" onclick="some_function();"><a href="page.php"><img src="image.jpg" /></a></li>

What is happening at the moment is that the <li> defines an area on which an onclick action occurs. The <a> defines a link that surrounds an image inside the onclick area. So, when I click on the image, it takes me to the new page as intended, but the onclick function defined in <li> is also activated. It just looks a bit messy.

So, does anyone know how to disable the onclick function ONLY when clicking on the image (so it goes straight to the link without anything else happening), but still leaving onclick function active for the rest of the <li> area?
__________________

Reply With Quote
  #2 (permalink)  
Old 04-14-2007, 02:48 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 2,154
Thanks: 290
Thanked 266 Times in 177 Posts
I would suggest to have an a-href for image separately and for text separately - simple way to solve it.

something like:
<li><a href="1"><img ...></a><a href="2">text</a></li1>
Reply With Quote
  #3 (permalink)  
Old 04-14-2007, 02:49 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 2,154
Thanks: 290
Thanked 266 Times in 177 Posts
sry - it should be <li><a href="1"><img ...></a><a href="" onclieck="action">text</a></li1>
Reply With Quote
  #4 (permalink)  
Old 04-14-2007, 03:27 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 575
Thanks: 14
Thanked 126 Times in 61 Posts
I will probably end up doing that....it won't look as nice, but it works at least.
__________________

Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling the NEWS SUMMARY GrinGEO General Help 0 11-03-2007 08:05 AM
Disabling a user sefs Bug Report 0 10-10-2007 12:23 PM
Help with disabling sidebar on certain pages! dollars5 General Help 6 09-21-2007 09:19 AM
Disabling Gzip EsCa General Help 1 08-16-2007 05:28 PM
Disabling user leads to PHP error roschler Bug Report 11 12-12-2006 01:06 PM


Search Engine Friendly URLs by vBSEO 3.2.0