son Posted November 22, 2008 Share Posted November 22, 2008 Firefox complains about my DOCTYPE, saying there is a syntax error. My top-code is: <?php // start output bufferingob_start();// initialize a sessionsession_start();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Where lies my mistake? Already tried to have doctype first, but same result...Son Link to comment Share on other sites More sharing options...
Ingolme Posted November 22, 2008 Share Posted November 22, 2008 Is this being output with an XML MIME type?If so, you'll probably have to add this in th PHP before the DTD. echo "<?xml version=\"1.0\" ?>"; Link to comment Share on other sites More sharing options...
son Posted November 22, 2008 Author Share Posted November 22, 2008 Is this being output with an XML MIME type?If so, you'll probably have to add this in th PHP before the DTD.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Tried the echo, but same error message...Son Link to comment Share on other sites More sharing options...
Ingolme Posted November 22, 2008 Share Posted November 22, 2008 Error message?I don't know why it would show an error message unless it was parsing XML, and if it's parsing XML it shouldn't output anything at all except the error message itself.Where is the message being displayed? What does it say? Link to comment Share on other sites More sharing options...
son Posted November 22, 2008 Author Share Posted November 22, 2008 Error message?I don't know why it would show an error message unless it was parsing XML, and if it's parsing XML it shouldn't output anything at all except the error message itself.Where is the message being displayed? What does it say?The Firefox console shows 'syntax error' relating to the doctype declaration. It does not say more... Do not understand...Son Link to comment Share on other sites More sharing options...
Ingolme Posted November 23, 2008 Share Posted November 23, 2008 If your page is working correctly then you don't need to pay attention to the firefox error console.It doesn't make much sense to me. Where is this page? It sounds as if Firefox was trying to parse it as Javascript. Link to comment Share on other sites More sharing options...
son Posted November 23, 2008 Author Share Posted November 23, 2008 If your page is working correctly then you don't need to pay attention to the firefox error console.It doesn't make much sense to me. Where is this page? It sounds as if Firefox was trying to parse it as Javascript.Funny that you say that. When I remove the Javascript reference the error message disappears. I include it via:<div><script type="text/javascript" src="../assets/date.js"></script></div>The code itself is:days = new Array(7)days[0] = "Sun";days[1] = "Mon";days[2] = "Tue";days[3] = "Wed";days[4] = "Thu";days[5] = "Fri";days[6] = "Sat";months = new Array(12)months[0] = "Jan";months[1] = "Feb";months[2] = "Mar";months[3] = "Apr";months[4] = "May";months[5] = "Jun";months[6] = "Jul";months[7] = "Aug";months[8] = "Sep";months[9] = "Oct";months[10] = "Nov";months[11] = "Dec";today = new Date();day = days[today.getDay()]month = months[today.getMonth()]date = today.getDate()if (date == 1)date = date + "st";if (date == 2)date = date + "nd";if (date == 3)date = date + "rd";if (date > 3)date = date + "th";document.write ("<span id='absolute'>" + day + " " + date + " " + month + "</span>") Can you see anything wrong with my code?Son Link to comment Share on other sites More sharing options...
Ingolme Posted November 24, 2008 Share Posted November 24, 2008 Is this script tag in the body of the document? Link to comment Share on other sites More sharing options...
jeffman Posted November 24, 2008 Share Posted November 24, 2008 I pasted your code into an xhtml document and a .js document and everything worked. I did not do anything with PHP. So something else must be going on. Maybe you just need to reboot?Then again, if you have PHP, why are you using javascript to generate the date text? Link to comment Share on other sites More sharing options...
son Posted November 24, 2008 Author Share Posted November 24, 2008 I pasted your code into an xhtml document and a .js document and everything worked. I did not do anything with PHP. So something else must be going on. Maybe you just need to reboot?Then again, if you have PHP, why are you using javascript to generate the date text?The script tag is in body of document and I use Javascript because the date display is not essential to website's functions and I tend to use Javascript as much as I can for those things (to not have to reload). Second reason is that I have never done this server-side;-)Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.