[thelist] Re: Mozilla 1.1a crashing (PC) Resolved +...

.jeff jeff at members.evolt.org
Tue Jul 16 22:20:01 CDT 2002


timothy,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Timothy Martens
>
> Thanks Jeff -- that did it. Can you explain the
> difference between "#" , "/" , and "Javascript://"
> for hrefs?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

well, the hash (#) is used to signify an in-page anchor.  it's followed by a
unique identifier that can be found in the name and/or id attribute of an
<a> tag somewhere on the page.  like so:

<a href="#myfoo">foo</a>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<h2><a name="foo" id="foo">foo</a></h2>

in the early days of javascript people tried all sorts of ways of making
links that did nothing when clicked.  many settled on the hash.  in
actuality, something does happen when a link using a hash is clicked.  most
browsers will cause the page to scroll back up to the top.  if you're dummy
link is not above the fold the click-bounce can be quite annoying.
fortunately it's avoidable.

that's where the "JavaScript://" value comes in.  the first part
"JavaScript:" is the javascript pseudo-protocol.  this tells the browser
that it should expect to execute some scripting as the value of the href
attribute.  it's similar in idea behind the http: protocol and the ftp:
protocol.  the "//" part of the value is just a single line comment, nothing
more.  so basically, this is a command to do nothing.  you'll often see
others use ";" which is a javascript end of line character, but i prefer to
not use that as it blends in with "JavaScript:;" too easily (did you even
notice that i included it in that last use?).  others will also use the
built-in void() function.  however, this was introduced with js1.1 so all
js1.0 browsers will throw errors when they encounter "JavaScript:void(0)" as
the value of an href attribute.

finally, the "/" href attribute value is simply a link to the root of the
site (http://domain.com/).

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> Also, how does one know which methods (status(),
> close(), etc. etc.) should have a return true or false
> or none? I found no reference to this is the
> Window.close section (p714) of Flanagan's text (3rd
> ed.)?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

give this article a read and see if it helps:

JavaScript: The Point of No Return?!
http://evolt.org/article/thelist/17/8869/

if you still have questions, holler back.

enjoy,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/





More information about the thelist mailing list