<div id="slider">
<img title="title #0" class="selectedItem" src="http://javascript.ru/forum/image.php?u=19820&dateline=1334914235" />
<img title="title #1" src="images/1.jpg" />
<img title="title #2" src="images/2.jpg" />
<img title="title #3" src="images/3.jpg" />
<img title="title #4" src="images/4.jpg" />
<img title="title #5" src="images/5.jpg" />
<img title="title #6" src="images/6.jpg" />
<img title="title #7" src="images/7.jpg" />
<img title="title #1" src="images/1.jpg" />
<img title="title #2" src="images/2.jpg" />
<img title="title #3" src="images/3.jpg" />
<img title="title #4" src="images/4.jpg" />
</div>
<script>
window.onload = function () {
var div = document.getElementById('slider');
mas = [//загоняете сюда адреса ссылок
'http://javascript.ru',
];
function index(elem) {
var elems = elem.parentNode.children;
var len = elems.length;
for (var i = 0; i < len; i++) {
if (elem == elems[i]) {
return i;
}
}
}
div.onmousedown = function (e) {
e = e || event;
var target = e.target || e.srcElement;
var a = target.parentNode;
if (a.tagName != 'A') {
var num = index(target);
var a = document.createElement('a');
div.insertBefore(a, target);
a.appendChild(target);
} else {
var num = index(a);
}
if (target.className == 'selectedItem') {
a.href = mas[num];
a.click();
} else {
a.href = '#';
}
}
}
</script>