ein Button zwei Bilder austauschen
agentin
- javascript
Hallo,
ich möchte gerne mein Skript erweitern, bis jetzt tauscht es nach Klick auf einen Button, ein Bild auf meiner Seite aus, jetzt möchte ich aber an zwei verschiedenen Stellen nach klick auf den Button Bilder austauschen.
Da müßte noch ein array dazu schätze ich, klappt aber nicht, weil ich nicht weiß, ob man eine Funktion zweimal für eine Aktion aufrufen kann...
<form method="POST" name="rotater">
<script language="JavaScript1.1">
var photos=new Array()
var which=0
/*Change the below variables to reference your own images. You may have as many images in the slider as you wish*/
photos[0]="content/an_1.jpg"
photos[1]="content/an_2.jpg"
photos[2]="content/an_3.jpg"
photos[3]="content/an_4.jpg"
photos[4]="content/an_5.jpg"
photos[5]="content/an_1.jpg"
function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which]
}
}
function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
}
else window.status='End of gallery'
}
</script>
<br>
<a href="#" onClick="backward()">
<img src="bilder/lin.gif" hspace="2" border="0"></a>
<a href="#" onClick="forward()">
<img src="bilder/rec.gif" hspace="2" border="0"></a><br>
<br>
</form>
Vielen Dank für die Hilfe
agentin