Link not working in IE

Discussion in 'HTML' started by Bruce A. Julseth, Mar 21, 2008.

  1. The following link works fine in Firefox but "Nothing" happens when I click
    on the link in IE? Any idea why?

    <a href="addNewPatient.php" target="_blank"><label>Add a new
    patient</label></a>

    Thanks..
     
    Bruce A. Julseth, Mar 21, 2008
    #1
    1. Advertising

  2. Bruce A. Julseth

    Guest

    On Mar 21, 7:23 pm, "Bruce A. Julseth" wrote:
    > The following link works fine in Firefox but "Nothing" happens when I click
    > on the link in IE?  Any idea why?
    >
    > <a href="addNewPatient.php" target="_blank"><label>Add a new
    > patient</label></a>
    >
    > Thanks..


    Remove the label tags, you can add if you want a title attribute to
    the
    <a> element.

    Why did you use the label element inside the <a> tags?
     
    , Mar 21, 2008
    #2
    1. Advertising

  3. Bruce A. Julseth wrote:
    > The following link works fine in Firefox but "Nothing" happens when I click
    > on the link in IE? Any idea why?
    >
    > <a href="addNewPatient.php" target="_blank"><label>Add a new
    > patient</label></a>


    Anyone's ability to help you relies entirely on whether the problem
    happens to lie in the small fraction of your code that you've chosen to
    show us.

    As it happens, it's enough to see that you've used a LABEL tag without
    any indication of what it's supposed to be a label for. What was your
    intention in using it?

    http://www.w3.org/TR/html4/interact/forms.html#h-17.9

    I'm guessing that given the choice between having your click passed on
    to the handler for labels and the handler for hyperlinks, IE is choosing
    to pass it on to the handler for labels. If your label were tied to a
    control as it's designed to be, your click would activate or pass focus
    to the control. Since there is no associated control, nothing happens at
    all.
     
    Harlan Messinger, Mar 21, 2008
    #3
  4. Both responses, asked how I was using the label. Here is an explaination.

    On the original form, I have a comboBox that loads a list of names. If the
    user doesn't find the person they are looking for in the comboBox, they
    click on this label to load a form "addNewPatient.php". This dialog, adds
    the "new patient" to the data base, then re-calls the original form, with
    the original comboBox loaded with this new person.

    How would you do what I am trying to do?

    All of this works fine in FireFox, but "Nothing" happens in IE. I removed
    the <label> tag and it now works in IE.

    Thanks..

    "Bruce A. Julseth" <> wrote in message
    news:RWTEj.25015$...
    > The following link works fine in Firefox but "Nothing" happens when I
    > click
    > on the link in IE? Any idea why?
    >
    > <a href="addNewPatient.php" target="_blank"><label>Add a new
    > patient</label></a>
    >
    > Thanks..
    >
    >
    >
     
    Bruce A. Julseth, Mar 21, 2008
    #4
  5. Bruce A. Julseth

    Guest

    On Mar 21, 8:08 pm, "Bruce A. Julseth" wrote:
    > How would you do what I am trying to do?


    Try with the <a> element inside the <label> element, like
    <label><a href="...">something</a></label>

    Usually the <label> element is associated with form controls,
    not with links.

    I quote from the HTML 4 spec about label
    To associate a label with another control implicitly,
    the control element must be within the contents of the LABEL element.
    In this case, the LABEL may only contain one control element.

    see
    http://www.w3.org/TR/REC-html40/interact/forms.html#edef-LABEL
     
    , Mar 21, 2008
    #5
  6. Yes, wrapping the "<a>" tag with the <label> tag also works.

    Thanks...

    <> wrote in message
    news:...
    On Mar 21, 8:08 pm, "Bruce A. Julseth" wrote:
    > How would you do what I am trying to do?


    Try with the <a> element inside the <label> element, like
    <label><a href="...">something</a></label>

    Usually the <label> element is associated with form controls,
    not with links.

    I quote from the HTML 4 spec about label
    To associate a label with another control implicitly,
    the control element must be within the contents of the LABEL element.
    In this case, the LABEL may only contain one control element.

    see
    http://www.w3.org/TR/REC-html40/interact/forms.html#edef-LABEL
     
    Bruce A. Julseth, Mar 21, 2008
    #6
  7. ..oO(Bruce A. Julseth)

    >Yes, wrapping the "<a>" tag with the <label> tag also works.


    Doesn't make it right. No form control, no label.

    Micha
     
    Michael Fesser, Mar 21, 2008
    #7
  8. Scripsit Harlan Messinger:

    >> <a href="addNewPatient.php" target="_blank"><label>Add a new
    >> patient</label></a>

    >
    > Anyone's ability to help you relies entirely on whether the problem
    > happens to lie in the small fraction of your code that you've chosen
    > to show us.


    Not entirely. It also depends on the current state of anyone's crystal
    ball and mind.

    > As it happens, it's enough to see that you've used a LABEL tag without
    > any indication of what it's supposed to be a label for.


    It's also enough for seeing an interesting technical problem, though
    it's not that interesting _pragmatically_. The problem vanishes in a
    puff of logic, when the redundant <label> markup is removed (or <a> and
    <label> are nested the other way around).

    Still, we have a genuine browser bug here. No matter what sense <label>
    might or might make inside <a>, it's valid and does not change the
    defined meaning of <a>.

    > What was your intention in using it?


    An interesting question as such. Here's a case where it would make
    sense:

    <input type="checkbox" ... id="compr">
    <a href="compr.html" title="Explanation of data compression applied">
    <label for="id">Compressed</label></a>

    That is, a normal combination of a field and its label, but with the
    label turned into a link to a document that explains what the choice
    means.

    Of course, now that we know the bug, we can avoid it by nesting the
    elements differently or using a different construct.

    > I'm guessing that given the choice between having your click passed on
    > to the handler for labels and the handler for hyperlinks, IE is
    > choosing to pass it on to the handler for labels.


    Sounds plausible. Interesting enough, IE (7) lets me focus on the text
    in the label (when using <a ...><label>...</label></a>), showing the
    focus rectangle. It also lets me activate something by hitting Enter,
    but then weird things happen. So this inaccessible in an exceptional
    sense: you can work with the keyboard, but not with the mouse: normal
    clicking does not work.

    Or _can_ you...? Yes, you can right click on the text and open the link
    via the menu.

    So here we have a partial answer to the question (asked somewhere
    recently) "how do I make a link non-clickable?" :) :)

    > If your label were
    > tied to a control as it's designed to be, your click would activate
    > or pass focus to the control. Since there is no associated control,
    > nothing happens at all.


    I actually tried to use the construct so that the label is tied to a
    control, and the control is indeed activated when the label is clicked.
    E.g., if the control is a checkbox, its state is toggled.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 21, 2008
    #8
  9. Bruce A. Julseth

    GTalbot Guest

    On 21 mar, 17:05, "Jukka K. Korpela" <> wrote:

    > Still, we have a genuine browser bug here. No matter what sense <label>
    > might or might make inside <a>, it's valid and does not change the
    > defined meaning of <a>.


    Correct. This weird-looking <label> inside an <a> code may be a
    variation (or a "cousin") of other label bugs:

    http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/#bug118

    http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/LabelForWithImage.html

    happens in both IE 7 and IE 8 beta 1


    > > What was your intention in using it?

    >
    > An interesting question as such. Here's a case where it would make
    > sense:
    >
    > <input type="checkbox" ... id="compr">
    > <a href="compr.html" title="Explanation of data compression applied">
    > <label for="id">Compressed</label></a>


    Jukka, did you mean to code
    <label for="compr">
    rather? ... pretty sure that's what you meant to do there...

    Regards, Gérard
    --
    Internet Explorer 8 bugs
    http://www.gtalbot.org/BrowserBugsSection/MSIE8Bugs/
     
    GTalbot, Mar 23, 2008
    #9
  10. Scripsit GTalbot:

    >> <input type="checkbox" ... id="compr">
    >> <a href="compr.html" title="Explanation of data compression applied">
    >> <label for="id">Compressed</label></a>

    >
    > Jukka, did you mean to code
    > <label for="compr">
    > rather? ... pretty sure that's what you meant to do there...


    Yes, surely. The <label> element is supposed to associate with the
    <input> element here. I was probably thinking "the 'for' attribute needs
    to contain the value of the 'id' attribute of the element it refers to",
    and then my brain took the wrong path.... :-(

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 23, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hon Seng Phuah

    link command is not working.

    Hon Seng Phuah, Jun 15, 2004, in forum: Perl
    Replies:
    1
    Views:
    532
    Joe Smith
    Jun 16, 2004
  2. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    949
    Kevin Spencer
    May 17, 2005
  3. Dan M
    Replies:
    5
    Views:
    458
  4. kolesdz
    Replies:
    9
    Views:
    567
    Blinky the Shark
    Aug 22, 2007
  5. Jiong Feng
    Replies:
    1
    Views:
    201
    Lasse Reichstein Nielsen
    May 15, 2004
Loading...

Share This Page