homepage Welcome to WebmasterWorld Guest from 54.226.191.80
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
W3C Validation Errors
''required attribute "type" not specified''
Jimbo123




msg:4134230
 8:21 pm on May 17, 2010 (gmt 0)

Hi there, just checking my site through the W3C validator, it seams to be coming up with 2 javascript errors, i've checked through the coding and the error seams to be coming from the 'Twitter' widgit I have on the page (see below)the error marked in bold is whats coming up as wrong, can anyone help?
Thanks, James.

<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>

new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 3,
interval: 6000,
width: 325,
height: 100,
theme: {
shell: {
background: '#333333',
color: '#ffaa00'
},
tweets: {
background: '#000000',
color: '#ff9900',
links: '#c7c7c7'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
hashtags: true,
timestamp: true,
avatars: false,
behavior: 'all'
}
}).render().setUser('furiousdesigns').start();
</script>

.............................................................

Line 117, Column 94: required attribute "type" not specified
48" valign="top"><script src="http://widgets.twimg.com/j/2/widget.js"></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>.

Line 118, Column 22: required attribute "type" not specified
<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>.

 

TheMadScientist




msg:4134234
 8:30 pm on May 17, 2010 (gmt 0)

You're missing exactly what it says ;)

<script src="http://widgets.twimg.com/j/2/widget.js" type="text/javascript"></script>
<script type="text/javascript">

lavazza




msg:4134235
 8:30 pm on May 17, 2010 (gmt 0)

You have the answer in the last line of your post :)

Instead of:
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>

Use:
<script type="text/javascript" src="http://widgets.twimg.com/j/2/widget.js"></script>
<script type="text/javascript">

lavazza




msg:4134236
 8:33 pm on May 17, 2010 (gmt 0)

<?php echo 'there's an echo in here'; ?>

;)

caribguy




msg:4134237
 8:33 pm on May 17, 2010 (gmt 0)

Hi Jimbo123 and welcome to WebmasterWorld [webmasterworld.com]

The answer is right there:
the "type" attribute is required on the "script" element [..] Typical values for type [..] type="text/javascript" for <script>.

In other words, change the first two lines as follows:

<script src="http://widgets.twimg.com/j/2/widget.js" type="text/javascript"></script>
<script type="text/javascript">

Are you sure you need to validate your document as XHTML? HTML 4.01 is more permissive and seems to be generally recommended by other posters here.

Edit: Wow! We're a helpful bunch :)

Jimbo123




msg:4134242
 8:43 pm on May 17, 2010 (gmt 0)

Hi Guys, thanks so much for all your help!Feel a bit of a numpty I didnt notice that before haha. :D

In regards to using XHTML instead of HTML 4.01 It's just the one that poped up when I first validated a CSS, it came as a 'Recomended link' from W3C. Is it better to use HTML 4.01 then?

Cheers.

lavazza




msg:4134245
 8:47 pm on May 17, 2010 (gmt 0)

Is it better to use HTML 4.01 then?

The answer is 'almost always: Yes!'

See Why most of us should NOT use XHTML [webmasterworld.com]

TheMadScientist




msg:4134254
 8:58 pm on May 17, 2010 (gmt 0)

Is it better to use HTML 4.01 then?

If you want to be ahead of the game you might look at HTML 5 too...

@ lavazza... LOL. I was clicking submit as fast as I could!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved