Need help with XHTML...Not too hard...

Soldato
Joined
19 Jul 2006
Posts
2,967
Location
Leicester
I have finished making my Website for a piece of Uni coursework.

It had to be XHTML compliant which it is, so it was all good.

Until our Teacher asked us to put in a bit of code to show when each page was last modified in order to stop us handing it in, then modifing it to gain a better mark.

The code is this...

<script language="Javascript">document.write(document.lastModified)</script>

It shows the last modified date, cool, but when I validate it to test if its XHTML compliant I get...The error message is all in yellow and the bit it highlights in the error message is in red...

Error : Line 97 column 32: required attribute "type" not specified.

<script language="Javascript">document.write(document.lastModified)</script>

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>


I thought the "type" was specified here...

<script language="Javascript">

Please help me, its due in on Wednesday.

Thanks for your time, Steve.
 
Last edited:
Augmented said:
Code:
<script language="Javascript">
should be
Code:
<script type="text/javascript">

Incidentally, document.write isn't supported in proper XHTML i.e. when sent as XML, not text/html.

Strange request by your tutor, you could just change the 'modified date' backwards on the file if you did change it later on anyway ;) :D.

Legend!
Thanks buddy :D

Here it is if your interested...
www.cse.dmu.ac.uk/~P06277359
Not very good but it covers all areas asked, so should get me full marks!
 
Last edited:
Hamish said:

Yeah, I like frames :D

I know you cant validate each page on the Website when using frames, so I have included in my E-Mail to my Tutor the link to each page on the Website ;)
 
KingAdora said:
Yes it validates, but you have entire pages of code using <h5> instead of <p>. Not good, and I'll overlook the frames bit! But if you get full marks, then that's what matters.

What course/year are you doing, out of interest?

Whats wrong with <h5>?
I have used a CSS if that makes any difference to your reply?
This is the first time I have done XHTML so go easy on me :p

I am doing, Business Information Technology and I am in year 1 :)
 
Mr^B said:
Top tip: if you have a site that mentions bad grammar and spelling mistakes in other websites, make sure your site doesn't have any.

:)

Is that just a tip or are you telling me mine has spelling mistakes and bad grammar? lol

Robmiller, thanks for the useful tip :)
The only reason I used <h5> for my paragraph text is becuase I had already used <p> for another style.
Could I have put in my CSS file...

p1 {css bits here}

Then used <p1>?
Would using that be better than <h5>?

Thanks :)
 
Back
Top Bottom