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

Showing the html?

P: n/a
Hello,

I am trying to create the html that someone would copy and paste to create a
link to our site. I want them to see the entire code and wrote the following
html:

<p>&lt;p>&lt;a href="http://www.mysite.com"Usability, User Interface
Design, &amp; Ergonomics &lt;/a>
- Internet Resources &amp; Consulting by Usernomics.&lt;/p>
</p>

This works fine except for the "&". I want the "&amp;" to show rather than
"&".
Can someone tell me what I have to do to permit the "&amp;" to show?

Thanks,

Bob
Mar 15 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Els
Hymer wrote:
Can someone tell me what I have to do to permit the "&amp;" to show?
&amp;amp;

:-)

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/

Now playing: Shabby Tiger - Slow Down
Mar 15 '07 #2

P: n/a
Scripsit Hymer:
I am trying to create the html that someone would copy and paste to
create a link to our site.
If you don't know that, and you don't know how to check authoritative
specifications on such matters, is your code really worth copying?
<p>&lt;p>&lt;a href="http://www.mysite.com"Usability, User Interface
Design, &amp; Ergonomics &lt;/a>
- Internet Resources &amp; Consulting by Usernomics.&lt;/p>
</p>
This raises many questions. Why do you use paragraph markup for something
that is not a paragraph, or even a complete sentence? Why should people who
copy the code use paragraph markup? Why the leading and trailing spaces in
the link text? (The latter probably has an impact on rendering.) Why do you
use the ASCII hyphen-minus character and not a dash character?

And why do you misrepresent the content of http://www.mysite.com ? Did you
even check what it is?
This works fine except for the "&".
For some odd values of "work".
I want the "&amp;" to show rather than "&".
Why? It might actually confuse people. It is true that it is generally
advisable (and obligatory in XHTML) to "escape" any occurrence of "&" as
data character, but a) your code isn't exemplary anyway, b) if people really
need your help to set up a simple link, they might get confused with
"&amp;", and c) an "&" when followed by a space works well in browsers (and
by classic HTML rules).

But yes, you _can_ make "&amp;" to show by writing e.g. "&amp;amp;" or (if
that confuses _you_) alternatively "&amp;".

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 15 '07 #3

P: n/a
>
>I am trying to create the html that someone would copy and paste to
create a link to our site.

If you don't know that, and you don't know how to check authoritative
specifications on such matters, is your code really worth copying?
><p>&lt;p>&lt;a href="http://www.mysite.com"Usability, User Interface
Design, &amp; Ergonomics &lt;/a>
- Internet Resources &amp; Consulting by Usernomics.&lt;/p>
</p>

This raises many questions. Why do you use paragraph markup for something
that is not a paragraph, or even a complete sentence? Why should people
who copy the code use paragraph markup? Why the leading and trailing
spaces in the link text? (The latter probably has an impact on rendering.)
Why do you use the ASCII hyphen-minus character and not a dash character?

And why do you misrepresent the content of http://www.mysite.com ? Did you
even check what it is?
>This works fine except for the "&".

For some odd values of "work".
>I want the "&amp;" to show rather than "&".

Why? It might actually confuse people. It is true that it is generally
advisable (and obligatory in XHTML) to "escape" any occurrence of "&" as
data character, but a) your code isn't exemplary anyway, b) if people
really need your help to set up a simple link, they might get confused
with "&amp;", and c) an "&" when followed by a space works well in
browsers (and by classic HTML rules).

But yes, you _can_ make "&amp;" to show by writing e.g. "&amp;amp;" or (if
that confuses _you_) alternatively "&amp;".

OK Jukka, you have taken me to task. As you can see, I don't know html very
well. Of course, that's why I asked the question, albeit the wrong one.

While I don't know the correct coding, the user will probably know even
less. I would like to get the correct coding to offer that person to make it
easy to copy/paste.

Can you suggest the correct coding for this purpose?

Thanks,

Bob

P.S. I did not check mysite. Sorry. I was just trying to not publicize my
URL inappropriately.
Mar 16 '07 #4

P: n/a
On Mar 15, 9:20 am, "Hymer" <ergobob@sonic[REMOVE].netwrote:
Hello,

I am trying to create the html that someone would copy and paste to create a
link to our site. I want them to see the entire code and wrote the following
html:
here is a simple solution [but requires js]-

<p id="insHere">Enable JS $=( </p>

<script type="text/javascript">
ELEM=document.getElementById("insHere")
TeXt='<p><a href="http://www.mysite.com"Usability, User Interface
Design, & Ergonomics </a- Internet Resources & Consulting by
Usernomics.</p>';
if(ELEM.textContent===undefined)
ELEM.innerText=TeXt
else
ELEM.textContent=TeXt
</script>

Mar 16 '07 #5

P: n/a
Scripsit sc*************@gmail.com:
here is a simple solution [but requires js]-
Well, the original question was ill-advised (someone is trying to give
others instructions on putting stuff on their pages without knowing HTML),
but that's not really an excuse for getting that nasty.

Maybe bogus questions deserve bogus answers, but this time, the question
wasn't bogus. The person is just trying to do something that shouldn't be
doing.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 16 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.