2 Replies Latest reply on Sep 11, 2008 12:01 PM by Zealus

    no href in "a" tag

    rogerconant Level 1
      I have a page http://justiceandpeace.net/qbl/index.html with some empty <a> references. The reason is, some tooltip software requires an "<a ...><img></a>" structure to work. In my page I have this:

      <a onMouseOver="Tip('<img src=\'photos/th75_greenhouse.jpg\' width=\'400\' height=\'366\'>',DELAY,200,FIX, [200, 128],CLOSEBTN,true)"><img src="images/enlarge.gif" width="85" height="21" border="0" ></a>

      which brings up a tooltip (a large image) when the mouse is over the " Enlarge image" image beneath the small image. It works. The odd thing is, I cannot use "<a href="#" etc>" or "<a href="" etc>" because although then when the user puts the mouse on the "Enlarge image" graphic it works (brings up the large image), but if s/he CLICKS the mouse there, the page jumps to the top. With NO href, there is no place to jump to, which is the desired behavior.

      The issue is, is it legal to have an "a" tag like this, with no href at all? I have tried all the usual browsers with no problems.
        • 1. Re: no href in &quot;a&quot; tag
          Level 7
          > The issue is, is it legal to have an "a" tag like this, with no href at
          > all?
          > I have tried all the usual browsers with no problems.

          Sure. A named anchor is sometimes exactly like that: <a name="foo">FOO</a>.

          > The odd thing
          > is, I cannot use "<a href="#" etc>" or "<a href="" etc>" because
          > although then when the user puts the mouse on the "Enlarge image" graphic
          > it
          > works (brings up the large image), but if s/he CLICKS the mouse there, the
          > page
          > jumps to the top.

          Change your code to this and that will stop -

          <a onMouseOver="Tip('<img src=\'photos/th75_greenhouse.jpg\' width=\'400\'
          height=\'366\'>',DELAY,200,FIX, [200, 128],CLOSEBTN,true) onclick="return
          false">
          --
          Murray --- ICQ 71997575
          Adobe Community Expert
          (If you *MUST* email me, don't LAUGH when you do so!)
          ==================
          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
          ==================


          "rogerconant" <webforumsuser@macromedia.com> wrote in message
          news:gabonr$9g7$1@forums.macromedia.com...
          >I have a page http://justiceandpeace.net/qbl/index.html with some
          >empty
          > <a> references. The reason is, some tooltip software requires an "<a
          > ...><img></a>" structure to work. In my page I have this:
          >
          > <a onMouseOver="Tip('<img src=\'photos/th75_greenhouse.jpg\'
          > width=\'400\'
          > height=\'366\'>',DELAY,200,FIX, [200, 128],CLOSEBTN,true)"><img
          > src="images/enlarge.gif" width="85" height="21" border="0" ></a>
          >
          > which brings up a tooltip (a large image) when the mouse is over the
          > " Enlarge image" image beneath the small image. It works. The odd
          > thing
          > is, I cannot use "<a href="#" etc>" or "<a href="" etc>" because
          > although then when the user puts the mouse on the "Enlarge image" graphic
          > it
          > works (brings up the large image), but if s/he CLICKS the mouse there, the
          > page
          > jumps to the top. With NO href, there is no place to jump to, which is
          > the
          > desired behavior.
          >
          > The issue is, is it legal to have an "a" tag like this, with no href at
          > all?
          > I have tried all the usual browsers with no problems.
          >

          • 2. Re: no href in &quot;a&quot; tag
            Zealus
            If by "legal" you mean weather you'll be slapped by a lawsuit from WWW consortium - then don't be afraid, they ain't after you.

            If by "legal" you mean "is that a proper syntax?" then yes, it is. HREF element is optional, as you may also have A NAME instead of HREF.

            It's just that if you don't use linking functionality - I'd use SPAN instead. However, I can see the point of using anchor tag to indicate some sort of action pending...