Forum Moderators: open

Message Too Old, No Replies

Use of noscript for valid XHTML

inside object tags?

         

valder

5:48 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



Hi,

when I use script and noscript tags in XHTML 1.0 Transitional, it doesn't validate unless I add object tags around them like this:

<object>
<script type="javascript">foo</script>
<noscript>whatever</noscript>
</object>

Is this the right way to do it?

It seems my favourite browser, Imbecile Explorer, chokes on it. It could also be Norton In-Security that messes up, but there's no difference even when I disable NIS. It works if I remove the object tags though.

Only IE has a problem with this, and my best guess is that IE is flawed (newsflash).

Am I writing bad code or is it some of the programs mentioned? Any ideas?

Eivind

Edouard_H

6:33 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



You can get rid of the <object> tags - start looking at any elements that contain either or both the script or noscript. Something isn't nested properly more likely than not.

valder

6:58 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



Yes, you're right. I didn't think it mattered that it was placed inside a paragraph.

Now I would have to make 2 copies of the entire paragraph, one for script and one for noscript. Unless anyone know of a better idea?

My current code is:

<p>
text here
<script type="text/javascript">
foo
</script>
<noscript>
text for noscript
</noscript>
text here
</p>

Is there a way to integrate scripts like this, or do I have to make 2 copies of the paragraph?

Thanks,
Eivind

valder

12:16 am on Jan 22, 2005 (gmt 0)

10+ Year Member



Apparently, paragraphs are not made to contain scripts. Div's however, aren't that picky about their content.

Perhaps I should just stop using p and use div for everything.

I have no problem with my code when I use div's, thanks for turning me in the right direction :) perhaps IE isn't flawed after all ;)

Anyway, this thread is in the wrong forum, should be in html.

Regards,
Eivind