Invalid HTML Questions about Embedding Flash Objects

I tried to validate my website’s html code, and I got a collection of errors I don’t know why they are there. Starting with this first one, Dreamweaver even has a selection for src in the <embed> tags. It has a lot of problems with this line of code and almost everything in it.


<embed src="pleaseselectapage.swf" menu="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="300" height="30" name="pleaseselectapage" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

the Doctype statement in my file is


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I also am getting errors about ul and li tags. My HTML menu code looks like this:


<ul>
		<li id="insurance"><a href="#">insurance</a>
    		<ul>
        		<li><a href="#">property insurance</a>
            		<ul>
                		<li><a href="#">under construction</a></li>
                	</ul>
            	</li>
            	<li><a href="#">auto insurance</a>
            		<ul>
                		<li><a href="#">under construction</a></li>
                	</ul>
            	</li>
            	<li><a href="#">health insurance</a>
            		<ul>
                		<li><a href="#">under construction</a></li>
                	</ul>
            	</li>
            	<li><a href="#">annuities</a>
            		<ul>
                		<li><a href="#">under construction</a></li>
                	</ul>
            	</li>
       	   </ul>
   	   </li>
	</ul>

The error says “document type does not allow element “ul” here; assuming missing “li” start-tag

Thanks for any input from you.

<embed> is not an official HTML element (though all browsers recognize it) so it will never validate.

That list you posted validates on its own, so perhaps the context is important?

I don’t know what you mean by the context of the list.

So if I can’t embed a flash object without the code staying valid, does that mean my JavaScript in the head tag will be ignored?

The <embed> tag isn’t valid in XHTML. I found a page that will take the embed code and turn it into valid XHTML (Validifier: Turn Flash embed code into valid XHTML), and this is what it coughed up:

<!--[if !IE]> -->
  <object type="application/x-shockwave-flash" data="pleaseselectapage.swf" width="300" height="30">
<!-- <![endif]-->
<!--[if IE]>
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="300" height="30">
    <param name="movie" value="pleaseselectapage.swf" />
<!--><!-- http://Validifier.com -->
  </object>
<!-- <![endif]-->

What a beneficial post, EarlyOut!

I do have a question though about this code you published. the <!-- [if IE]> code block is left commented out. Won’t this eliminate the code from being recognized even if the user is browsing with Internet Explorer?

No, that’s the way conditional comments work - IE sees them, but other browsers ignore them: CSS - Conditional comments

Taken in isolation, the code is ok, but it may not be playing nicely with other code on your page. Most likely, there is a missing closing tag on another element, which makes the validator choke when it sees a <ul> when it expects something else.

Regarding validation, don’t get too caught up in it. Validation is just a guide. It doesn’t mean the page won’t work. <embed> is supported in all browsers. The validator is just there to alert you to possible problems. But then it’s up to you to use your judgment over whether it’s really a problem or not. <embed> is not a problem.

Thank you for your post!

The reason I have been looking at this closely is because I feel the JavaScript inside my <head> tag inside this index.php file is being ignored. Actually, I’m sure it’s being ignored. Would it solve the problem to move this script into an external file?

It shouldn’t matter, as long as the Javascript is within proper <script> tags. But we can’t see your page, so…

you can try looking at it from productreviewsbytyler.com . That’s not this page, an unused domain I have before I buy the one for this site.

Javascript embedding looks OK to me, though I can’t tell what it’s supposed to be doing.

On the nested lists, you can’t embed a <ul> in another <ul>. It has to be embedded in an <li>. For example:

<ul type="square">
    <li>Main Unordered Bulleted List item 1</li>
    <li>Below is an example of HTML nested unordered list with bullets
        <ul type="disc">
            <li>nested list item 1</li>
            <li>nested list item 2</li>
            <li>Sub nested unordered list
                <ul type="circle">
                    <li>sub nested list item 1</li>
                    <li>sub nested list item 2</li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

Thank you for your AWESOME response.