Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Can't understand this href  (Read 3536 times)

0 Members and 1 Guest are viewing this topic.

frank fazzio

  • Guest
Can't understand this href
« on: December 27, 2007, 03:57:48 PM »
I'm trying to teach myself HTML and Javascript.  The basic books seems to skip over some "basics."  I've spent the last 4 hours with my nose in reference books and in search engines trying to find out what the "#" in the following link tag means.  I read this in one of my instructional books and I am just plain stuck.  Here it is
          <a id="products" href="#">
  • Products[/url]

Everything else in this anchor/link tag is clear to me but I cannot figure out what the "#" refers to.  There are no anchors set within this HTML page. Is this some sort of shorthand for a standard location within the same document/page?

Stumped!
Frank Fazzio

michaewlewis



    Intermediate
  • Thanked: 26
    • Yes
    • Yes
  • Experience: Expert
  • OS: Unknown
Re: Can't understand this href
« Reply #1 on: December 27, 2007, 04:34:31 PM »
# is just a filler. It doesn't mean anything. You usually put it in an href when you are doing some sort of scripting with javascript and the script is doing the relocation or other work. I've used the # when using an onmouseover, or onclick, or other onmouse events.

mitz



    Greenhorn
    Re: Can't understand this href
    « Reply #2 on: January 03, 2008, 03:11:23 PM »
    I think it looks like a substitue for where you put the url to link to Products. 

    <a id="products" href="http://www.site/product catalog.htm">
    Products[/url]
    #=url ???
    Maybe thats what it means. What a terrible book not explaining things properly.
    Have a great day :)

    squall_01



      Prodigy

      Thanked: 80
      Re: Can't understand this href
      « Reply #3 on: January 04, 2008, 03:29:46 AM »
      I don't know javascript but I did take html.  ummmm..... <A href=''"> Link name[/url]  the id tag is if someone runs the mouse over it and wants to know what it is.  The # is probably a place holder something that your to supposed to have put your own link there. 
      Windows 7 RC Tester.  Working on it.  Your monitor says etchasketch on the side!

      If I fall who is there to pick me up now.  I stand alone but I stand as the gaurdian for whom I wish to protect.  The sound of my blade utters my name as you fall.  For I shall not move.  For those that forsake the very people are wosres

      michaewlewis



        Intermediate
      • Thanked: 26
        • Yes
        • Yes
      • Experience: Expert
      • OS: Unknown
      Re: Can't understand this href
      « Reply #4 on: January 04, 2008, 10:59:44 AM »
      # is just a filler. It doesn't mean anything. You usually put it in an href when you are doing some sort of scripting with javascript and the script is doing the relocation or other work. I've used the # when using an onmouseover, or onclick, or other onmouse events.

      That's the answer. ok.... ::)

      CBMatt

      • Mod & Malware Specialist


      • Prodigy

      • Sad and lonely...and loving every minute of it.
      • Thanked: 167
        • Yes
      • Experience: Experienced
      • OS: Windows 7
      Re: Can't understand this href
      « Reply #5 on: January 06, 2008, 04:53:58 PM »
      You guys are just going to confuse the OP.  michaewlewis is on the right track...it typically just acts as filler.  If you use that in place of a URL, it won't do anything.  Well, aside from redirecting you to the top of the page.  Technically, that's what it is designed to do: redirect viewers to different sections of the page.  Because # alone is empty, it redirects to the top.  However, you can control its actions by applying name anchors throughout your page.  For example, if you have a music section on your page, you can make something like this...

      <a name="music">My Music[/url]



      Then, when someone clicks on the below link...

      <a href="#music">LINK[/url]

      ...it will automatically redirect them to the My Music section.  It can be quite useful.



      When it comes to needing non-linking filler, I prefer using javascript: void(0); rather than #.
      Quote
      An undefined problem has an infinite number of solutions.
      —Robert A. Humphrey