Help with <noscript>

H

Helpful person

First I apologise for asking what sems to be a syntax question, but I
have been unable to find any illucidation for my problem by searching
on line.

I cannot get <noscript> to work properly. I am using it to display an
image in the event of javascript being disabled. It seems to display
as I want. However, it does no validate. My web page is:

www.newftpwebsite.richardfisher.com/index.shtml

username richard
password fisher

It does not validate for HTML giving the following three errors:

Line 130, Column 94: document type does not allow element "IMG" here;
missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "DIV",
"ADDRESS" start-tag
… "email" width = "164" height = "18">

Line 131, Column 17: end tag for "NOSCRIPT" which is not finished
</noscript>

Line 132, Column 8: end tag for element "P" which is not open
</p>

If remove the <noscript> and </noscript> lines (near bottom of page)
it does validate.

What am I doing wrong?
 
D

dorayme

Helpful person said:
First I apologise for asking what sems to be a syntax question, but I
have been unable to find any illucidation for my problem by searching
on line.

I cannot get <noscript> to work properly. I am using it to display an
image in the event of javascript being disabled. It seems to display
as I want. However, it does no validate. My web page is:

www.newftpwebsite.richardfisher.com/index.shtml

username richard
password fisher

It does not validate for HTML giving the following three errors:

Line 130, Column 94: document type does not allow element "IMG" here;
missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "DIV",
"ADDRESS" start-tag
Š "email" width = "164" height = "18">

Line 131, Column 17: end tag for "NOSCRIPT" which is not finished
</noscript>

Line 132, Column 8: end tag for element "P" which is not open
</p>

If remove the <noscript> and </noscript> lines (near bottom of page)
it does validate.

What am I doing wrong?

No need to double entry the script link in the head. About the trouble,
remove the P and substitute a DIV for enclosing the script and noscript
elements. It is hardly a paragraph semantically anyway and Ps are
notoriously fussy about what they will allow in them.
 
H

Helpful person

No need to double entry the script link in the head. About the trouble,
remove the P and substitute a DIV for enclosing the script and noscript
elements. It is hardly a paragraph semantically anyway and Ps are
notoriously fussy about what they will allow in them.


Thanks. However, I've replaced the <p> with a <div> and am still
getting validation errors. (I removed the double link, didn't realize
I had in twice.)
 
R

rf

Helpful said:
First I apologise for asking what sems to be a syntax question, but I
have been unable to find any illucidation for my problem by searching
on line.

I cannot get <noscript> to work properly. I am using it to display an
image in the event of javascript being disabled. It seems to display
as I want. However, it does no validate. My web page is:

www.newftpwebsite.richardfisher.com/index.shtml

username richard
password fisher

It does not validate for HTML giving the following three errors:

Line 130, Column 94: document type does not allow element "IMG" here;
missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "DIV",
"ADDRESS" start-tag
… "email" width = "164" height = "18">

Go here:
http://www.w3.org/TR/html401/interact/scripts.html#edef-NOSCRIPT
and read up on what a noscript element may contain. It says (%block;). Img
is not a block level element so it cannot be the direct child of a noscript
element, just as it cannot be the direct child of a body element.

Wrap the img element in a suitable block level element, a list of which may
be appropriate being given in the error message above.
 
D

dorayme

Helpful person said:
Thanks. However, I've replaced the <p> with a <div> and am still
getting validation errors. (I removed the double link, didn't realize
I had in twice.)

OK. The trouble, which I missed, (my BBEdit Editor misled me by not
picking it up, and also a useful browser iCab missed it too and I did
not check with the classier http://validator.w3.org/), is that - Oh
dear, I feel a trance like state coming upon me, words being forced into
me - Img is not a block level element so it cannot be the direct child
of a noscript element, just as it cannot be the direct child of a body
element. Wrap the img element in a suitable block level element, a list
of which may be appropriate being given in the error message above. <g>

But you still have to be rid of the <p class="pfooter"> I said before
because that was giving a different error altogether. You can see for
yourself by reinstating it but fixing up for the obscure - who but an
eagle-eyed skiing type could know about it - noscript itself needing a
block element. <g>
 
J

Jukka K. Korpela

Helpful said:
First I apologise for asking what sems to be a syntax question, but I
have been unable to find any illucidation for my problem by searching
on line.

Did you try reading the syntax description in HTML specs?
I cannot get <noscript> to work properly.

Most people have no idea of how to use it, so validation issue (which is
what you are asking about) is really a 5th class question.
I am using it to display an
image in the event of javascript being disabled. It seems to display
as I want. However, it does no validate. My web page is:

www.newftpwebsite.richardfisher.com/index.shtml

To make it validate, you need to use valid HTML. When you declare HTML 4.01
Strict, you need to play by its rules to make the document validate. This
means that <noscript> has only block elements as its children. In this case,
you would need to use <noscript><div><img ...></div></noscript>.

On the other hand, it would be more natural and more useful to make the
<img> element part of the document's static content and use JavaScript to
replace that element by something else.

And most importantly, you're doing the wrong thing. Instead of announcing
your email address as textual content (the sensible thing if you want
prospective customers to contact you by email), you're putting it there as
an image with a clueless alt text and using JavaScript to put the address
there textually. Rather complicated and error-prone.

As usual, "spam protection" causes more harm than spam. You prevent, among
other things, blind people from contacting you at all. And you urge spammers
to develop better bots that use JavaScript-enabled harvesters or maybe cheap
human labor to collect addresses. All of this does not affect the fact that
you're bound to get spam sooner or later to any address and need to have
some spam filter anyway.
 
H

Helpful person

Thanks everyone. It's now working fine. I did check the w3 standard
but my unfamiliarity with the syntax of the document led me to miss
the inline / block issue.

Again I would like to say how grateful I am to the excellent support
in this forum. I would be floundering even worse than I am without it.
 
H

Harlan Messinger

Helpful said:
First I apologise for asking what sems to be a syntax question, but I
have been unable to find any illucidation for my problem by searching
on line.

I cannot get <noscript> to work properly. I am using it to display an
image in the event of javascript being disabled. It seems to display
as I want. However, it does no validate. My web page is:

www.newftpwebsite.richardfisher.com/index.shtml

username richard
password fisher

It does not validate for HTML giving the following three errors:

Line 130, Column 94: document type does not allow element "IMG" here;
missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "DIV",
"ADDRESS" start-tag
… "email" width = "164" height = "18">

Line 131, Column 17: end tag for "NOSCRIPT" which is not finished
</noscript>

Line 132, Column 8: end tag for element "P" which is not open
</p>

If remove the <noscript> and </noscript> lines (near bottom of page)
it does validate.

What am I doing wrong?

You are putting the IMG *directly* inside a "NOSCRIPT". You aren't
putting it inside a "P", "H1", "H2", "H3", "H4", "H5", "H6", "DIV", or
"ADDRESS". So put it inside one of these (I suspect a DIV would be the
most appropriate) and the message telling you that it isn't inside one
of these will go away.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top