Greenguy's Board


Go Back   Greenguy's Board > General Business Knowledge
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2016-02-09, 04:51 AM   #1
ecchi
Banned
 
ecchi's Avatar
 
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?
ecchi is offline   Reply With Quote
Old 2016-02-09, 08:26 AM   #2
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Doc type tells the engine in the browser how it should interpret the page.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2016-02-09, 04:24 PM   #3
ecchi
Banned
 
ecchi's Avatar
 
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?"
ecchi is offline   Reply With Quote
Old 2016-02-09, 04:36 PM   #4
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
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
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2016-02-10, 04:16 AM   #5
ecchi
Banned
 
ecchi's Avatar
 
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>
Which basically says "I'm using some kind of html, but I'm not going to tell you what version - work it out for yourself", which the browser already knew from the .html file extension.
ecchi is offline   Reply With Quote
Old 2016-02-15, 03:54 PM   #6
ecchi
Banned
 
ecchi's Avatar
 
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.
ecchi is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:46 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc