Forum Moderators: travelin cat
clicking on an image to run the functions 'moveLeft' and 'moveRight' using this tag:
<a onclick="javascript:moveLeft()" href="#">
doesn't seem to do anything. Code as below:
function display(m) {
document.all.productname.innerHTML = product[m][0];
document.all.price.innerHTML = "£" + product[m][1];
document.all.number_of.innerHTML = (m+1) + " of " + product.length;
document.tshirt_big.src = "images/tshirt_big_" + (m+1) + ".jpg";
}
function moveLeft() {
if (n>0) {
n = n - 1;
display(n);
}
}
function moveRight() {
if (n<(number_of_items - 1)) {
n = n + 1;
display(n);
}
}
from searching I've done I realise Safari has some problems with javascript, I'm guessing that either Safari does not recognise the ID's of the elements I want changed, or does not recognise 'onclick'. Does anyone have any fixes?
thanks in advance
Instead use "document.getElementById"
There are mentions of this in:
[developer.apple.com...]
=======================
Peter Walsham
[edited by: jatar_k at 5:07 pm (utc) on Nov. 23, 2005]
[edit reason] no sigs thanks [/edit]