All these things happened after I put a dtd up top.
My Page is XHTML 1.0 Strict Compliant, It's CSS also validates.
Firefox 2-
Javascript doesn't work.
IE7-
Page doesn't display at all.
In Opera 9-
The page is fine.
Safari 3-
Javascript doesn't work.
Netscape 8-
Javascript doesn't work.
What can I do or what am I doing wrong?
http://www.xsquareddev.net/main.html
NOTE: My page was fine before I put in the dtd.
Last edited by coreymanshack on Tue Sep 04, 2007 5:16 am; edited 1 time in total
hmmm.... since when has script had no ending tag?
| Quote: |
| <script type="text/javascript" src="setup.js"/> |
Try
| Code: |
| <script type="text/javascript" src="setup.js"></script> |
Javascript works. It's just because your code is wrong : there isn't any spacer4 element...
Mathiaus, some tags don't have to be closed (like <img>) and since the page validates at W3C <script> apparently is one of them. Ranfaroth is probably right.
| Wikipedia wrote: |
| Note: The format <script ...></script>, rather than the more concise <script ... />, is required for HTML compatibility when served as MIME type text/html. |
------------------------------------
Ranfaroth is also correct though
| Code: |
numelements = 4;
numelements++;
for( i=1; i<numelements; i++) { |
It would normally go 1, 2, then 3, however before the function, numelements is incremented for some reason (why not change 4 to 5?). Remove that line OR change the 4 to 3 OR add the spacer4 element.
The spacer 4 element is not added for a reason! RRawr, I told you guys there was not a problem with my code, I'll take out the dtd, and everything will work fine! I'm not even sure you guys read the whole post. In opera, nothing is wrong, in IE7 my page DOESN'T Display.
I fixed the mime type and now use the xml header instead. Tried <script></script> Still no results. Added spacer 4, just to fancy you guys, still no results. I'll take out the dtd, and I'll show you guys that it works.I also put in the xhtml 1.1 dtd, and then again, it didn't work.
http://www.xsquareddev.net/nodtd.html
Netscape, JS worked, Safari, JS worked, Firefox, JS worked, Opera was fine... but what is really weird....
IE7 Page didn't display again, I take out the script tag, and IE7 displays.
What's going on here!?
EDIT: Figured out why IE7 didn't display, it doesn't like the short tags <script/> Thanks mathius.
So now, All browsers work until I put in my dtd.
ONCE AGAIN- This validates as valid xhtml 1.0 strict, and the css validates through w3c's validator.
On the incrementing part. It is setting up a transparent background behind 4 div's, these div's need to be spaced besides the last element, putting a spacer 4 would make my document end up having overflow.
numelements, is 4 because there are 4 elements to put a background behind. if I start the incrementing at 0, then the script would not work because there is no start element named transparent0 or bodytext0
Just for the heck of it, I made the program not edit the height of the element spacer 4 which does not exist.
I fixed it in firefox, I'll check the other browsers later, I got to go to work right now.
Since you corrected your code, I don't see differences between the 2 pages (except images...).
I confirm you, using a doctype (and not a DTD, it's not the same thing), won't break javascript. (the contrary would be well known
...)
| Ranfaroth wrote: |
Since you corrected your code, I don't see differences between the 2 pages (except images...).
I confirm you, using a doctype (and not a DTD, it's not the same thing), won't break javascript. (the contrary would be well known ...) |
? a doctype is the same as a dtd.
IE doesn't understand the ... /> notation for self-closing tags. For most tags, like img, this doesn't matter as it just sees the slash as superfluous and interprets it as an old-style single tag. But for a script tag, IE treats the script tag as then being opened and never closed - so it treats the rest of the page as script and it doesn't display. This bug caught me out a while back as well.
| coreymanshack wrote: |
| ? a doctype is the same as a dtd. |
No : read this page.
| qscomputing wrote: |
| IE doesn't understand the ... /> notation for self-closing tags. For most tags, like img, this doesn't matter as it just sees the slash as superfluous and interprets it as an old-style single tag. But for a script tag, IE treats the script tag as then being opened and never closed - so it treats the rest of the page as script and it doesn't display. This bug caught me out a while back as well. |
that wasn't the whole bug... you have to use xhtml complaint javascript also.
and as for Ranafaroth
[quote=Ranafaroth]
Since you corrected your code, I don't see differences between the 2 pages (except images...).
I confirm you, using a doctype (and not a DTD, it's not the same thing), won't break javascript. (the contrary would be well known Rolling Eyes...)[/quote]
I looked at the page, it leads me to believe DTD stands for document type decleration wich in short is also doctype
and i also don't know why this was brought up?
| coreymanshack wrote: |
| I looked at the page, it leads me to believe DTD stands for document type decleration wich in short is also doctype |
Read it again... DTD is Document Type Definition...
| Ranfaroth wrote: |
| coreymanshack wrote: | | I looked at the page, it leads me to believe DTD stands for document type decleration wich in short is also doctype | Read it again... DTD is Document Type Definition... |
If you can't tell DTD is the first letter of all three words on those names, so either one will work really, it's just a matter of opinion and it really doesn't need to be argued. My saying that it doesn't need to be argued doesn't need to be argued either. As far as this post is concerned it can be closed because it's creating spam.
| coreymanshack wrote: |
| so either one will work really, it's just a matter of opinion and it really doesn't need to be argued. |
It's not a matter of opinion, is a matter of convention...
Just look at you, you use your opinion which is contrary to the convention : people have to ask for details and they realize you were wrong....
For the last time :
Document Type Definition -> DTD
Document Type Declaration -> Doctype.
It's simple, and I can't see where do you block...