By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,246 Members | 1,304 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,246 IT Pros & Developers. It's quick & easy.

Linking to other web pages

P: n/a
Hi,

What's the difference between using <a href="/foldername/otherpage.html">
(double quotes) and <a href='/foldername/otherpage.html'>(single quotes)?

Thanks,
J. Christopher
Jul 20 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
"J. Christopher Miller" <th*******@earthlink.net> wrote in
news:M5*****************@newsread2.news.pas.earthl ink.net:
Hi,

What's the difference between using <a href="/foldername/otherpage.html">
(double quotes) and <a href='/foldername/otherpage.html'>(single quotes)?


None whatsoever. You can use either type of quote around attribute values
(as long as both the opening and closing quote are the same type). That's
so that if, for some reason, the attribute value has to contain a quote
character of one type, you can use the other type to surround it (note that
it's a good idea to quote all attribute values; in XHTML you have no choice
but to do so; in HTML there are a few circumstances where you can omit the
quotes, but they're not worth memorizing).
Jul 20 '05 #2

P: n/a

"Eric Bohlman" <eb******@earthlink.net> wrote in message
news:Xn******************************@130.133.1.4. ..
"J. Christopher Miller" <th*******@earthlink.net> wrote in
news:M5*****************@newsread2.news.pas.earthl ink.net:
Hi,

What's the difference between using <a href="/foldername/otherpage.html"> (double quotes) and <a href='/foldername/otherpage.html'>(single
quotes)?
None whatsoever. You can use either type of quote around attribute values
(as long as both the opening and closing quote are the same type). That's
so that if, for some reason, the attribute value has to contain a quote
character of one type, you can use the other type to surround it


.... though that's for sheer convenience, since you can also just substitute
an entity reference (&quot;) or a character code.

Jul 20 '05 #3

P: n/a
"Harlan Messinger" <h.*********@comcast.net> schrieb im Newsbeitrag
news:c2*************@ID-114100.news.uni-berlin.de...

"Eric Bohlman" <eb******@earthlink.net> wrote in message
news:Xn******************************@130.133.1.4. ..
"J. Christopher Miller" <th*******@earthlink.net> wrote in
news:M5*****************@newsread2.news.pas.earthl ink.net:
Hi,

What's the difference between using <a href="/foldername/otherpage.html"> (double quotes) and <a href='/foldername/otherpage.html'>(single quotes)?

None whatsoever. You can use either type of quote around attribute
values (as long as both the opening and closing quote are the same type). That's so that if, for some reason, the attribute value has to contain a quote
character of one type, you can use the other type to surround it


... though that's for sheer convenience, since you can also just

substitute an entity reference (&quot;) or a character code.


Sometimes you need quotes inside attribute values, for example if you call a
javascript function with an argument in an event handler. Of course you
could also escape them with a backslash, so you are still right and it is an
issue of convenience.

--
Markus
Jul 20 '05 #4

P: n/a

"Markus Ernst" <derernst@NO#SP#AMgmx.ch> wrote in message
news:40***********************@news.easynet.ch...
"Harlan Messinger" <h.*********@comcast.net> schrieb im Newsbeitrag
news:c2*************@ID-114100.news.uni-berlin.de...

"Eric Bohlman" <eb******@earthlink.net> wrote in message
news:Xn******************************@130.133.1.4. ..
"J. Christopher Miller" <th*******@earthlink.net> wrote in
news:M5*****************@newsread2.news.pas.earthl ink.net:

> Hi,
>
> What's the difference between using <a href="/foldername/otherpage.html">
> (double quotes) and <a href='/foldername/otherpage.html'>(single

quotes)?

None whatsoever. You can use either type of quote around attribute values (as long as both the opening and closing quote are the same type). That's so that if, for some reason, the attribute value has to contain a quote character of one type, you can use the other type to surround it


... though that's for sheer convenience, since you can also just

substitute
an entity reference (&quot;) or a character code.


Sometimes you need quotes inside attribute values, for example if you call

a javascript function with an argument in an event handler. Of course you
could also escape them with a backslash, so you are still right and it is an issue of convenience.


It still works, even with nested Javascript quotes inside a Javascript text
string. See:

http://gavelcade.com/nestedquotes.html

No single quotes are used, the first level of nested double quotes appears
as &quot;, and the second level as \&quot;, with the Javascript \ escape.

Jul 20 '05 #5

P: n/a
Eric Bohlman wrote:
in HTML there are a few circumstances where you can omit the
quotes, but they're not worth memorizing).


I have a very simple system...

Quote alphanumeric values, leave numeric values unquoted.

That's perhaps from my background as a programmer, but I have no problem
whatsoever in remembering this distinction between strings and numbers...
Jul 20 '05 #6

P: n/a
Tim
Eric Bohlman wrote:
in HTML there are a few circumstances where you can omit the
quotes, but they're not worth memorizing).


"Keld R. Hansen" <ne**@www.heartware.dk> posted:
I have a very simple system...

Quote alphanumeric values, leave numeric values unquoted.


So far as I'm aware, something like 45% has to be quoted, and that's a
numerical value.

My system is simpler; quote everything. ;-)

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #7

P: n/a
Tim <ti*@mail.localhost.invalid> wrote:
So far as I'm aware, something like 45% has to be quoted, and
that's a numerical value.
Not to mention +1. To confuse those who don't quote, -1 doesn't need to
be quoted. Besides, #000000 is a numerical value too, in a sense.
My system is simpler; quote everything. ;-)


Right. When in doubt, quote. And when not in doubt, quote.

Just remember to stop routinely quoting when you move to CSS, which has
its own rules (e.g., in font-family, "serif" is not the same as serif).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #8

P: n/a
Tim wrote:
I have a very simple system...

Quote alphanumeric values, leave numeric values unquoted.
So far as I'm aware, something like 45% has to be quoted, and that's a
numerical value.


"%" is not a numeric character, therefore "45%" is not a numeric value
(as I - as a programmer - understand it). Therefore "45%" is an
alphanumeric value, and therefore it is quoted :).
My system is simpler; quote everything. ;-)


And waste a lot of bytes in the process :-).

--
Keld R. Hansen
http://index.epguides.info

(To reply by email, remove the WorldWideWeb prefix from the domain name)
Jul 20 '05 #9

P: n/a
On Fri, 05 Mar 2004 10:25:16 +0100, "Keld R. Hansen"
<ne**@www.heartware.dk> wrote:
Eric Bohlman wrote:
in HTML there are a few circumstances where you can omit the
quotes, but they're not worth memorizing).


I have a very simple system...

Quote alphanumeric values, leave numeric values unquoted.

That's perhaps from my background as a programmer, but I have no problem
whatsoever in remembering this distinction between strings and numbers...


Except that in this case the distinction doesn't exist! The characters
where you can omit the quotes are all the alphanumerics, plus a couple
of others that I never bother to remember.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #10

P: n/a
Tim
Unattributed sources wrote:
I have a very simple system...

Quote alphanumeric values, leave numeric values unquoted.


Tim wrote:
So far as I'm aware, something like 45% has to be quoted, and that's a
numerical value.

"Keld R. Hansen" <ne**@www.heartware.dk> posted:
"%" is not a numeric character, therefore "45%" is not a numeric value
(as I - as a programmer - understand it). Therefore "45%" is an
alphanumeric value, and therefore it is quoted :).
It *is* a "numerical value," it happens to use alphanumerical characters
though. There's a difference in semantics. Forty-five percent is a
"numerical value," you just didn't describe your rule situation very good
in the first place (as a programmer, you should understand that). ;-)

Anyone else being told there's no need to quote "numerical values" would,
quite easily, believe that they didn't have to quote any numerical value.
And based on the advice, it wouldn't be their fault.
My system is simpler; quote everything. ;-)

And waste a lot of bytes in the process :-).


I wouldn't consider it a significant number.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #11

P: n/a
Tim wrote:
So far as I'm aware, something like 45% has to be quoted, and that's a
numerical value.

"%" is not a numeric character, therefore "45%" is not a numeric value
(as I - as a programmer - understand it). Therefore "45%" is an
alphanumeric value, and therefore it is quoted :).

It *is* a "numerical value," it happens to use alphanumerical characters
though. There's a difference in semantics. Forty-five percent is a
"numerical value," you just didn't describe your rule situation very good
in the first place (as a programmer, you should understand that). ;-)


As a *programmer*, 45% is *not* a numerical value. I don't know of any
programming language that allows me to write "A=45%" as a stand-alone
statement without the compiler complaining about it :-).

Now, as a *mathematician*, I agree with you, that 45% is a numerical
value (equal to 0.45), but I specifically stated, that I meant a
numerical value as expected by me as a *programmer* :-).

Anyway, my system works. Any value consisting of the characters "0"-"9"
(ASCII values 48-57, or 0x30-0x39) is left unquoted. Anything else is
quoted.

And before you start including decimal points in the discussion: I have
yet to see an attribute value capable of expressing a numerical,
fractional value (what - I can't specify an image as being 50.34 pixels
wide? ;-))

Keld R. Hansen
http://startrek.epguides.info
Jul 20 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.