| 
| 
 | 
 | 
 | 
 | 
 | 
| 		
			
			 | 
		#1 | 
| 
			
			
			
			 Banned 
			
			
		
			
				
			
			
			Join Date: Oct 2003 
				Location: About to be evicted!!!! 
				
				
					Posts: 4,082
				 
				
				
				
				 | 
	
	
	
		
		
			
			 
				
				Doctype And Older Versions Of HTML
			 
			Can anyone explain why this works? 
		
	
		
		
		
		
		
		
		
		
		
	
	I used an online service to create a slideshow for my site. It worked on my Vista box, but on my XP box it only worked in Chrome, not in IE8. So I assumed it was in HTML5. Today I was playing with the code with a view to (a) using it on other sites, and (b) making a version that worked on all browsers. I discovered the slider was entirely Javascript, so should work on IE8. Buggering about with it, I found that adding a doctype tag (doctype html) made it work. Why should this be? Why when everything else appears to work 100% OK without a declaration of doctype, should one Javascript piece of code require a doctype declaration?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#2 | 
| 
			
			
			
			 Subversive filth of the hedonistic decadent West 
			
			
		
			
				
			
			
			Join Date: Mar 2003 
				Location: Southeast Florida 
				
				
					Posts: 27,936
				 
				
				
				
				 | 
	
	
	
		
		
		
		
		 Doc type tells the engine in the browser how it should interpret the page. 
		
	
		
		
		
		
		
		
			
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#3 | 
| 
			
			
			
			 Banned 
			
			
		
			
				
			
			
			Join Date: Oct 2003 
				Location: About to be evicted!!!! 
				
				
					Posts: 4,082
				 
				
				
				
				 | 
	
	
	
		
		
		
		
		 Yeah, sorry I wasn't clear. My question was "In that IE8 automatically assumes anything with a .html extension is  a HTML document, why does it ignore certain javascript commands unless it is told the item is a HTML document in the document, by the doctype statement?" 
		
	
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#4 | 
| 
			
			
			
			 Subversive filth of the hedonistic decadent West 
			
			
		
			
				
			
			
			Join Date: Mar 2003 
				Location: Southeast Florida 
				
				
					Posts: 27,936
				 
				
				
				
				 | 
	
	
	
		
		
		
		
		 Because there is more than one kind of html doc and the doctype tells it what kind it is and what t do with its code. 
		
	
		
		
		
		
		
		
			
		
		
		
		
		
		
	
	The doctype control parsing of the page in order to display it correctly. http://www.w3.org/QA/2002/04/valid-dtd-list.html  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#5 | 
| 
			
			
			
			 Banned 
			
			
		
			
				
			
			
			Join Date: Oct 2003 
				Location: About to be evicted!!!! 
				
				
					Posts: 4,082
				 
				
				
				
				 | 
	
	
	
		
		
		
		
		 Yes but without the declaration it processes most Javascript perfectly, so why not all Javascript? Also the declaration I am making does not tell it what version of HTML I'm using, I simply added: 
		
	
		
		
		
		
		
		
		
		
		
	
	Code: 
	<!DOCTYPE html>  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#6 | 
| 
			
			
			
			 Banned 
			
			
		
			
				
			
			
			Join Date: Oct 2003 
				Location: About to be evicted!!!! 
				
				
					Posts: 4,082
				 
				
				
				
				 | 
	
	
	
		
		
		
		
		 I was given the answer over the weekend. If anyone wants to know: 
		
	
		
		
		
		
		
		
		
		
		
	
	It was not the Javascript, it was "div id=" which was the problem. Apparently IE8 knows some HTML commands that were not instigated when it was created, but had been mooted. If it is not fed a HTML type, it sticks strictly to the HTML that was official when it was released (which I think was HTML 3). However it takes "!DOCTYPE html" to mean "follow all HTML notification you know" so using this gets it to accept a few later HTML commands.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
	
	
		
  | 
	
		
  |