• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

tooltips brauche zu viel platz

Kurt Cobain

New member
Tag Tag

also ich hab mir ne image map gemacht und will, dass man wenn man über ein bestimmtes feld mit

der maus drüberfährt ein tooltip kommt.


so hab ich das gemacht
HTML:
  <!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title></title>
<meta name="author" content="Manuel">
<meta name="generator" content="Ulli Meybohms HTML EDITOR">

<style type="text/css">
<!--
.tooltip{
    position: absolute;
    display: none;
    background-color: #eeeeee;
    color:#000000;
    border: 2px solid #000000;
    line-height:22px;
    font-weight:normal;
    z-index:100;
}
-->
</style>

</head>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">







  <map name="Landkarte"  style="padding: 0px; margin: 0px;">
    <area shape="rect" coords="0,0,10,10"   onmouseover="showWMTT('1')" onmouseout="hideWMTT()">
        <div class="tooltip" id="1" valign="center"><table><tr><td></td><td>feld nummer 1</td><td></td></tr></table></div>

    <area shape="rect" coords=""  onmouseover="showWMTT('2')" onmouseout="hideWMTT()">
        <div class="tooltip" id="2" valign="center"><table><tr><td></td><td>feld nummer 2</td><td></td></tr></table></div>

//hier kommen eigendlich noch mehr areas , hab sie jetzt aber weggelaassen
  </map>
<img src="./files/invisible.gif" width="1000" height="1000"  alt="Karte" usemap="#Landkarte">





<script>
<!--
wmtt = null;

document.onmousemove = updateWMTT;

function updateWMTT(e) {
        x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
        y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
        if (wmtt != null) {
                wmtt.style.left = (x + 20) + "px";
                wmtt.style.top         = (y + 20) + "px";
        }
}

function showWMTT(id) {
        wmtt = document.getElementById(id);
        wmtt.style.display = "block"
}

function hideWMTT() {
        wmtt.style.display = "none";
}
//-->
</script>
</body>
</html>



aber wenn ich jetzt viele areas definier braucht das jetzt ziemlich viel platz.

da ich mich nicht so mit JS auskenn wollt ich fragen, ob man das script noch kleiner machen kann,

vielleicht mit ner while schleife oder so,dass man wenn man dort:(onmouseover="showWMTT('1')")

eine zahl reinschreibt, dass sie dann gleich im tooltiop erscheint??


gruß ich
 
Zurück
Oben