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:
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.
 
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 ;)
 
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?
 
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 :)
 
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.

:)
 
stevechapman said:
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 :)

h5 is a fifth level header; it shouldn't be used for paragraph text, that's what the oddly named paragraph tag is for, <p>.

You should always try to use semantic markup--that is, markup that describes the document's logical structure rather than what it looks like.

Ideally, anything presentational should be in CSS: XHTML should convey only the document's structure.
 
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 :)
 
No, that's what classes are for.

Code:
<style type="text/css">
p.description { color:red; }
p.author { color:red; }
</style>

<h5>A Book About Foo</h5>

<p class="author">J. B. Priestley</p>

<p class="description">This book is about foos.</p>
 
stevechapman said:
....
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 :)

You would have had to make a new class, doing the method you have mentioned. So a new class of the tag <p>.. so in your CSS you would have had something like:

p.1{
.....
......
}

Then in the HTML done <p class="1"></p> etc.

This site has a brief explanation on ID's/Classes.
;)
 
Back
Top Bottom