Dynamische Buttons und Link
Spike
- javascript
Hi zusammen,
ich hab ein Problem. Ich habe einen Link mit einem Bild darunter. Also ein Href mit einem Img. Das Bild wird mit dem klassischen Bilderwechsel in Javascript befeuert, allerdings nicht, wenn man über das Bild selbst fährt, sondern über einen Button im Übergeordneten Menü (das ganze ist eine Menüsteuerung). Also der Button ist mit einer leeren Dummygrafik bestückt, und wird bei aktivieren des Überbuttons mit einer sichtbaren Grafik gefüllt. Das funktioniert auch wunderbar, allerdings hab ich das Problem, das der Link nicht da ist. Wenn die Grafik angezeigt wird, funzt der Link nicht. Weiß jemand Rat!? Bin mit meinem Latein am Ende.
Ciao
Spike
Da musst du den Code posten!
Andy
Alles klar,
Also:
Javascriptfunktion
<script language="JavaScript1.2">
<!--
//Grafikdefinition für das Banduntermenü
SubShapeBand = new Image();
SubShapeBand.src = "img/SubShapeBand.gif";
ProfileButt = new Image();
ProfileButt.src = "img/profilebutt.gif";
GalleryButt = new Image();
GalleryButt.src = "img/gallerybutt.gif";
HistoryButt = new Image();
HistoryButt.src = "img/historybutt.gif";
//Grafikdefinition für das Musicuntermenü
SubShapeMusic = new Image();
SubShapeMusic.src = "img/SubShapeMusic.gif";
SongsButt = new Image();
SongsButt.src = "img/songsbutt.gif";
DiscButt = new Image();
DiscButt.src = "img/Discobutt.gif";
GigsButt = new Image();
GigsButt.src = "img/Gigsbutt.gif";
//Grafikdefinition für das Comuntermenü
SubShapeCom = new Image();
SubShapeCom.src = "img/SubShapeCom.gif";
GuestButt = new Image();
GuestButt.src = "img/guestbookbutt.gif";
ForumButt = new Image();
ForumButt.src = "img/Forumbutt.gif";
ContactButt = new Image();
ContactButt.src = "img/Contactbutt.gif";
//Dummydefinitionen
DummyShape = new Image();
DummyShape.src = "img/dummyshape.gif";
DummyButton = new Image();
DummyButton.src = "img/dummybutt.gif";
function Bildwechsel(Bildnr,Bildobjekt)
{
window.document.images[Bildnr].src = Bildobjekt.src;
}
function Shapechange(Shapenr)
{
if (Shapenr==0)
{
//Shapes werden alle eingezogen
window.document.images[0].src = DummyShape.src;
window.document.images[1].src = DummyButton.src;
window.document.images[2].src = DummyButton.src;
window.document.images[3].src = DummyButton.src;
window.document.images[4].src = DummyShape.src;
window.document.images[5].src = DummyButton.src;
window.document.images[6].src = DummyButton.src;
window.document.images[7].src = DummyButton.src;
window.document.images[8].src = DummyShape.src;
window.document.images[9].src = DummyButton.src;
window.document.images[10].src = DummyButton.src;
window.document.images[11].src = DummyButton.src;
}
if (Shapenr==1)
{
//Bandshape ist angesagt
window.document.images[0].src = SubShapeBand.src;
window.document.images[1].src = ProfileButt.src;
window.document.images[2].src = GalleryButt.src;
window.document.images[3].src = HistoryButt.src;
}
if (Shapenr==2)
{
//Musicshape ist angesagt
window.document.images[4].src = SubShapeMusic.src;
window.document.images[5].src = SongsButt.src;
window.document.images[6].src = DiscButt.src;
window.document.images[7].src = GigsButt.src;
}
if (Shapenr==3)
{
//Comshape ist angesagt
window.document.images[8].src = SubShapeCom.src;
window.document.images[9].src = GuestButt.src;
window.document.images[10].src = ForumButt.src;
window.document.images[11].src = ContactButt.src;
}
}
//-->
//-->
</script>
Button der gewechselt werden soll:
<div style="position:absolute; top:255px; left:195px;">
<a href=newsprev.htm target="Hauptframe">
<img src="img/dummybutt.gif" onClick="top.document.body.cols = '230,*'" border=0>
</a></div>
Und hier der Button, der das ganze auslöst:
<div style="position:absolute; top:222px; left:23px;">
<input type="image" src="img/musicbutt.gif" onClick="Shapechange(0);Shapechange(2);top.document.body.cols = '360,*'"">
</div>
Ciao
Spike
Da musst du den Code posten!
Andy