すみません、>>7 は撤回します。いろいろ難しく考え過ぎてた。
とにかく、XHTML の script 要素内で "<" と "&" は使わないで下さい。整形式でなくなってしまう(">"、"|" は構いません)。もしくは、CDATA 区間か外部スクリプトにして下さい。
<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
<title>TEST</title>
</head>
<body>
<p><img src="banner0.png" alt="*" id="BANNER" name="BANNER" /></p>
<script type="text/javascript">//<![CDATA[
function SrcList () {
this.length = 0;
Array.prototype.push.apply (this, arguments);
}
function ImagePrefetcher (args) {
var i = 0;
var I = args.length;
while (i < I) (new Image).src = args[i++];
}
function SrcChanger (src) {
this.src = src;
// this.setAttribute ('src', src);
}
function ImageChanger () {
this.counter = (++this.counter) % this.length;
SrcChanger.call (this.image, this[ this.counter ]);
}
function BannerList (image) {
this.image = image;
this.counter = 0;
SrcList.apply (this, arguments);
this[0] = image.src;
// this[0] = image.getAttribute ('src');
ImagePrefetcher (this);
}
BannerList.prototype.change = function () {
ImageChanger.call (this);
}
var image = document.getElementById ('banner');
// var image = document.images['banner'];
var BL = new BannerList (image, 'banner1.png', 'banner2.png', 'banner3.png');
setInterval (function () { BL.change (); }, 2000);
// ]]></script>
</body>
</html>