Forum Moderators: open

Message Too Old, No Replies

Slideshow

         

Dakota

6:53 pm on Feb 17, 2005 (gmt 0)

10+ Year Member



Hi, I am using this slideshow script,

<script language="JavaScript" type="text/JavaScript">

<!-- Begin
NewImg = new Array (
"images/BD_DGRB.jpg",
"images/BD_GRB.jpg",
"images/BD_LBRB.jpg",
"images/BD_PRB.jpg",
"images/BD_pwwRB.jpg",
"images/BD_showRB.jpg",
"images/BD_ZRB.jpg",
"images/TBcreambox.jpg",
"images/TBdarkbluebox.jpg",
"images/TBredrigid.jpg",
"images/BD_HRB.jpg"
);
var ImgNum = 0;
var ImgLength = NewImg.length - 1;

//Time delay between Slides in milliseconds
var delay = 3000;

var lock = false;
var run;
function chgImg(direction) {
if (document.images) {
ImgNum = ImgNum + direction;
if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}
document.slideshow.src = NewImg[ImgNum];
}
}
function auto() {
if (lock == true) {
lock = false;
window.clearInterval(run);
}
else if (lock == false) {
lock = true;
run = setInterval("chgImg(1)", delay);
}
}
// End -->
</script>

and it works great but it is also putting this into the head section of the page when it is live.

<script language="JavaScript">
<!--

function SymError()
{
return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

//-->
</script>

The problem is, is that it is making the page not valid <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> with W3C standards.Any ideas on how can I fix this?

Thanks

Bernard Marx

7:19 pm on Feb 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This isn't a Javascript issue really. It's about valid markup.
Perhaps you'd be better off next door [webmasterworld.com].

A couple of pointers:

- The language attribute (of script tag) is deprecated.
- probably need proper CDATA tags to wrap the script's text in.

So:

- Get rid of the language attribute.
- Put the script into an external script file.

sorted..
..maybe.

Dakota

7:53 pm on Feb 17, 2005 (gmt 0)

10+ Year Member



Thanks for the quick response. I will put it in a external file and see if that works.

Thanks again
Dakota

orion_rus

8:33 pm on Feb 17, 2005 (gmt 0)

10+ Year Member



U can better type it here [validator.w3.org] and it types all errors what needs to be replaced. Good luck to you

Dakota

1:36 am on Feb 18, 2005 (gmt 0)

10+ Year Member



Well I linked it to a external .js file and it works fine but I still am getting errors when I try and validate it. Thing is when I validate it before I go live with it, it is ok. All the errors seem to be on the link <script language="JavaScript"script src="../scoll.js"></script>.
Here is the errors I am getting,

1. Line 8, column 29: required attribute "type" not specified

<script language="JavaScript">

2. Line 30, column 36: "script" is not a member of a group specified for any attribute

<script language="JavaScript"script src="../scoll.js"></script>

3. Line 30, column 53: required attribute "type" not specified

<script language="JavaScript"script src="../scoll.js"></script>

4.Line 165, column 29: required attribute "type" not specified

<script language="JavaScript">

5.Line 165, column 29: document type does not allow element "script" here

<script language="JavaScript">

any idea what I am doing wrong?
Thanks

Bernard Marx

8:14 am on Feb 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The language attribute is deprecated.

<script type="text/javascript">

Bernard Marx

8:54 am on Feb 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



5.Line 165, column 29: document type does not allow element "script" here

Are you using a strict doctype?
Is the script file not in the HEAD?

Do some doctypes not allow script blocks in the BODY?
I don't know, but that's what it's suggesting.

Dakota

4:10 pm on Feb 18, 2005 (gmt 0)

10+ Year Member



OK, I got it down to 1 error:)

1. Line 104, column 60: "script" is not a member of a group specified for any attribute

<script language="JavaScript"type="text/javascript"script src="../scoll.js"></script>.

Thanks alot for taking the time to help out!

Bernard Marx

4:27 pm on Feb 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



?

- REPEAT: The language attribute is deprecated
- where did that extra 'script' come from?

<script type="text/javascript" src="../scoll.js"></script>