Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / June 2007



Tip: Looking for answers? Try searching our database.

Image inside span doesn't trigger hyperlink

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aleko - 29 Jun 2007 03:25 GMT
Hi,

I have a hyperlink styled to look like a button, which can also
contain an image, before the text. The link works in FF, but in IE
clicking the img doesn't trigger the link. Clicking the text in the
same span does.

If I move the img outside the span then it works. Is this a known
issue, and if so, is there a workaround? I've tied using different
types of tags to contain the image, but none of them made any
difference.

HTML:

<a class="btn" href="javascript:document.forms[0].submit();">
    <span><img src="images/checkmark.gif" alt="" />ok</span></a>

CSS:

.btn
{
    background:url(images/button/btn-std-l.gif) no-repeat left top;
    display:inline-block !important; /* for IE7, FF */
    line-height:22px;
    padding:0px 0px 0px 6px;
    text-decoration:none;
    cursor:hand; /* remind IE this is a link */
}
.btn span
{
    background:url(/Cornerstone-6.6/images/button/btn-std-r.gif) no-
repeat right top;
    display:inline-block !important;
    height:22px;
    line-height:22px;
    padding:0px 6px 0px 0px;
    font-size:10pt;
}

.btn img
{
    border:none;
    vertical-align:middle;
}

Thanks,

Aleko
Jonathan N. Little - 30 Jun 2007 01:15 GMT
> Hi,
>
[quoted text clipped - 12 lines]
> <a class="btn" href="javascript:document.forms[0].submit();">
>     <span><img src="images/checkmark.gif" alt="" />ok</span></a>

If this is supposed to post a form, then use a submit button, that is
what they are for! HREF's with pseudo-protocol "javascript:" is a very
bad idea and not reliable. If you want a pretty picture for your submit
button then use <input type="image" ... >

Signature

Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.