Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo zusammen.

Ich habe folgendes Problem.

Ich habe auf meiner Homepage in der Navigationsleiste Bilder als Buttons.

Wenn ich jetzt mit der Maus über einen Button fahre, möchte ich, dass ein anderes Bild kommt (ein helleres).

Wie kann ich das lösen?

Das weiss ich auch. Aber wie schreibe ich den Code?

Ich habe jetzt einfach ein Hyperlink gemacht und statt den Text einfach das Bild:

<a href="lager.html" target="main"><img src="buttons\lager.jpg" ></a>

Ich will jetzt, dass ein anderes Bild kommt, wenn ich mit der Maus drauffahre.

Hat ca. zehn Minuten googeln und etwas probieren gedauert.

<html>
<body>

<script language="JavaScript">
<!--
function an()
{
document["image"].src = "bild2.jpg"
}
function aus()
{
document["image"].src = "bild1.jpg"
}
-->
</script>

<a href=""><img src="bild1.jpg" onmouseover="an()" onmouseout="aus()" name="image"></a>
</body>
</html>[/code]

Frank

  • 2 Wochen später...

hat geklappt! Danke

Das geht auch etwas schicker mit css. JS braucht man dafür nicht extra nutzen.

<html>

  <body>

    <style>


      a {

        background-image: url('test.jpg');

        width: 50px;

        height: 50px;

        display: block;

      }


      a:hover {

        background-image: url('test2.jpg');

      }


    </style>


    <a href="#"></a>


  </body>

</html>

basic

<img src="egitimler/Photoshop.jpg" border="0" title="Photoshop" onmouseout="this.src='egitimler/Photoshop.jpg';" onmouseover="this.src='egitimler/PhotoshopOFF.jpg';"/>

dynamic

asp

<img src="egitimler/<%=rs(images)%>.jpg" border="0" title="<%=rs(images)%>." onmouseout="this.src='egitimler/<%=rs(images)%>..jpg';" onmouseover="this.src='egitimler/<%=rs(imagesOFF)%>..jpg';"/>

php

<img src="egitimler/<?=images?>.jpg" border="0" title=<?=images?>.." onmouseout="this.src='egitimler/<?=images?>.jpg';" onmouseover="this.src='egitimler/<?=imagesoff?>.jpg';"/>

asp.net

.cs

public static string rollover;

rollover = "";

for (int i = 0; i < 10;i++ )

{

rollover = rollover + "<img src=egitimler/" + Rs["images"] + ".jpg border=0 title= + Rs["images] + " onmouseout=this.src='egitimler/" + Rs["images"] + ".jpg'; onmouseover=this.src=egitimler/" + Rs["imagesoff] + ".jpg';/>";

}

rollover = rollove;

aspx

<table><tr><td><%=rollover%></td></tr></table>

Das geht auch etwas schicker mit css. JS braucht man dafür nicht extra nutzen.

<html>

  <body>

    <style>


      a {

        background-image: url('test.jpg');

        width: 50px;

        height: 50px;

        display: block;

      }


      a:hover {

        background-image: url('test2.jpg');

      }


    </style>


    <a href="#"></a>


  </body>

</html>
Wenn man schon die JS Funktion durch CSS Code ersetzt, dann bitte auch mit einem Preload ;) Ich hatte dazu mal ein "Tutorial" geschrieben, das ich gerne hier auch noch einmal reinsetze. Beispiel für CSS Preload: preload.jpg (Eine Grafik! 100x50px)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>CSS Preload</title>

<style type="text/css">

<!--

.preload a {

    background:scroll url(images/preload.jpg) -0 -0 no-repeat;

    width:100px;

    height:25px;

    display:block;

}


.preload a:hover {

    background:scroll url(images/preload.jpg) -0 -25px no-repeat;

}

-->

</style>

</head>


<body>


    <div class="preload"><a href="#" target="_self"></a></div>


</body>

</html>

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.