Javascript-форум (https://javascript.ru/forum/)
-   Javascript под браузер (https://javascript.ru/forum/css-html/)
-   -   IE 7 помогите разобраться ... (https://javascript.ru/forum/css-html/24349-ie-7-pomogite-razobratsya.html)

bogong 27.12.2011 09:28

IE 7 помогите разобраться ...
 
Есть скрипт:
var imageDirectory='../js/images/';
var imageFileType='.png';
var imageName=["001","002","003","004","005"];
var imageListLength=imageName.length-1;
var counter=0;
function pageInit(){
	var img=document.createElement('IMG');
	img.setAttribute('src', imageDirectory+imageName[counter]+imageFileType);
	img.setAttribute('id', 'img');
	document.getElementById('banner').appendChild(img);
	var br=document.createElement('BR');
	document.getElementById('banner').appendChild(br);
	var previousImage=document.createElement('A');
	previousImage.setAttribute('href', '');
	previousImage.setAttribute('onclick', 'javascript:previousImage();return false;');
	previousImage.innerHTML='Bwd';
	document.getElementById('banner').appendChild(previousImage);
	var nextImage=document.createElement('A');
	nextImage.setAttribute('href', '');
	nextImage.setAttribute('onclick', 'javascript:nextImage();return false;');
	nextImage.innerHTML='Fwd';
	document.getElementById('banner').appendChild(nextImage);
	
	var ul=document.createElement('UL');
	ul.setAttribute('id', 'bannerMenu');
	document.getElementById('banner').appendChild(ul);
	for(var i=0; i<imageName.length; i++){
		var li=document.createElement('LI');
		li.innerHTML='<a href="" onclick="javascript:image('+i+');return false;">'+imageName[i]+'</a>';
		document.getElementById('bannerMenu').appendChild(li);
	}
	
	var test=document.createElement('P');
	document.getElementById('banner').appendChild(test);
	var p=document.createTextNode('Интернет-агентство DEV Company\n\
		занимается продвижением и созданием сайтов в городе Санкт-Петербурге. \n\
		Разработкой веб-ресурсов, а именно  интернет-магазинов и развлекательных порталов. \n\
		Privet, privet Lena');
	test.appendChild(p);
}
function nextImage(){
	var img=document.getElementById("img");
	if(++counter>imageListLength){
		counter=0;
	}
	img.src=imageDirectory+imageName[counter]+imageFileType;
}
function previousImage(){
	var img=document.getElementById("img");
	if(--counter<0) {
		counter=imageListLength;
	}
	img.src=imageDirectory+imageName[counter]+imageFileType;
}
function image(i){
	var img=document.getElementById("img");
	img.src=imageDirectory+imageName[i]+imageFileType;
	counter=i;
}
window.onload=pageInit;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<title>Galary</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<script src="../js/js/gal01.js"></script>
</head>

<body>
	<div id="banner"></div>
</body>
</html>


Во всех броузерах работает нормально, кроме IE7 ... В этом самом интересном броузере происходит следующее: скрипт привязан к страничке index1.html ..., а он почему то при нажатии вперед или назад перебрасывает на index.html

рони 27.12.2011 10:53

bogong,
setAttribute в ие неработает так как вы бы хотели.


Часовой пояс GMT +3, время: 09:51.