Sp 76

From Htmlpedia
Jump to: navigation, search

OpenSP: Element ... undefined


You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:

  • incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element)
  • by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
  • by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).

For most tags, the reason is that there is other ways to achieve the same result with standard tags or with CSS.

Example 1:

Bad<nobr>there is no wrapping here</nobr>
Good<table><tr><td nowrap>there is no wrapping here</td></tr></table>

<span style="white-space: nowrap;">there is no wrapping here</span>

NOBR is not approved by the W3C; <nobr> turns off wordwrapping between the start and end NOBR tag. There are several ways to replace a NOBR with a standard tag :

  • You can use the nowrap attribute of the TR and TD tag in a table. In that case, the <br /> element to force line breaks where desired.
  • The best solution is to use a cascaded style sheet with the attribute: white-space: nowrap;.

Example 2:

Bad<object width="400" height="300"><param name="movie" value="movie.swf"/>

<embed src="movie.swf" width="400" height="300"/>

Good<object width="400" height="300" type="application/x-shockwave-flash" data="movie.swf">

<param name="movie" value="movie.swf" />


EMBED does not exist in HTML. It is a proprietary tag.

Example 3:

Bad<script type="text/javascript">

function count(items){

   for (var i=0;i<items.length;i++){ do something}


Good<script type="text/javascript">

/* <![CDATA[ */

function count(items){

   for (var i=0;i<items.length;i++){ do something}


/* ]]> */



Replace the tag with the equivalent in standard HTML.

Contents of javascript tags begin with "<![CDATA[" and end with "]]>"