Tom: Perfektion

Hallo liebe Forumler,

habe mir ein Rollover Script gebaut und empfinde es Persönlich als zu gross...

könnte mir hier jemand vieleicht einen Rat geben wie ich das Script verkleinern kann um die Ladezeiten zu schonen?

Hier das Script:

//Navigation
hlight_off = new Image();
hlight_off.src = "img/t_hlight_off.gif";
hlight_on = new Image();
hlight_on.src = "img/t_hlight_on.gif";

hlight1_off = new Image();
hlight1_off.src = "img/t_hlight_off.gif";
hlight1_on = new Image();
hlight1_on.src = "img/t_hlight_on.gif";

hlight2_off = new Image();
hlight2_off.src = "img/t_hlight_off.gif";
hlight2_on = new Image();
hlight2_on.src = "img/t_hlight_on.gif";

hlight3_off = new Image();
hlight3_off.src = "img/t_hlight_off.gif";
hlight3_on = new Image();
hlight3_on.src = "img/t_hlight_on.gif";

hlight4_off = new Image();
hlight4_off.src = "img/t_hlight_off.gif";
hlight4_on = new Image();
hlight4_on.src = "img/t_hlight_on.gif";

hlight5_off = new Image();
hlight5_off.src = "img/t_hlight_off.gif";
hlight5_on = new Image();
hlight5_on.src = "img/t_hlight_on.gif";

hlight6_off = new Image();
hlight6_off.src = "img/t_hlight_off.gif";
hlight6_on = new Image();
hlight6_on.src = "img/t_hlight_on.gif";

hlight7_off = new Image();
hlight7_off.src = "img/t_hlight_off.gif";
hlight7_on = new Image();
hlight7_on.src = "img/t_hlight_on.gif";

hlight8_off = new Image();
hlight8_off.src = "img/t_hlight_off.gif";
hlight8_on = new Image();
hlight8_on.src = "img/t_hlight_on.gif";

hlight9_off = new Image();
hlight9_off.src = "img/t_hlight_off.gif";
hlight9_on = new Image();
hlight9_on.src = "img/t_hlight_on.gif";

hlight10_off = new Image();
hlight10_off.src = "img/t_hlight_off.gif";
hlight10_on = new Image();
hlight10_on.src = "img/t_hlight_on.gif";

hlight11_off = new Image();
hlight11_off.src = "img/t_hlight_off.gif";
hlight11_on = new Image();
hlight11_on.src = "img/t_hlight_on.gif";

hlighta_off = new Image();
hlighta_off.src = "img/t_hlight_off.gif";
hlighta_on = new Image();
hlighta_on.src = "img/t_hlight_on.gif";

hlightb_off = new Image();
hlightb_off.src = "img/t_hlight_off.gif";
hlightb_on = new Image();
hlightb_on.src = "img/t_hlight_on.gif";

hlightc_off = new Image();
hlightc_off.src = "img/t_hlight_off.gif";
hlightc_on = new Image();
hlightc_on.src = "img/t_hlight_on.gif";

hlightd_off = new Image();
hlightd_off.src = "img/t_hlight_off.gif";
hlightd_on = new Image();
hlightd_on.src = "img/t_hlight_on.gif";

hlighte_off = new Image();
hlighte_off.src = "img/t_hlight_off.gif";
hlighte_on = new Image();
hlighte_on.src = "img/t_hlight_on.gif";

hlightf_off = new Image();
hlightf_off.src = "img/t_hlight_off.gif";
hlightf_on = new Image();
hlightf_on.src = "img/t_hlight_on.gif";

hlightg_off = new Image();
hlightg_off.src = "img/t_hlight_off.gif";
hlightg_on = new Image();
hlightg_on.src = "img/t_hlight_on.gif";

hlighth_off = new Image();
hlighth_off.src = "img/t_hlight_off.gif";
hlighth_on = new Image();
hlighth_on.src = "img/t_hlight_on.gif";

hlighti_off = new Image();
hlighti_off.src = "img/t_hlight_off.gif";
hlighti_on = new Image();
hlighti_on.src = "img/t_hlight_on.gif";

hlightj_off = new Image();
hlightj_off.src = "img/t_hlight_off.gif";
hlightj_on = new Image();
hlightj_on.src = "img/t_hlight_on.gif";

hlightk_off = new Image();
hlightk_off.src = "img/t_hlight_off.gif";
hlightk_on = new Image();
hlightk_on.src = "img/t_hlight_on.gif";

hlightl_off = new Image();
hlightl_off.src = "img/t_hlight_off.gif";
hlightl_on = new Image();
hlightl_on.src = "img/t_hlight_on.gif";

hlightm_off = new Image();
hlightm_off.src = "img/t_hlight_off.gif";
hlightm_on = new Image();
hlightm_on.src = "img/t_hlight_on.gif";

Aufruf erfolgt in der Form:

<td align='left'><img src='img/t_hlight_off.gif' width='22' height='14' border='0' alt='' name='hlight'></td>
   <td align='left'><a href='php/klicks.php?url=../beispiel.php'
   onMouseOver="hlight.src=hlight_on.src"
   onMouseOut="hlight.src=hlight_off.src">beispiel</a></td>
   <td align='right'><img src='img/t_end.jpg' width='15' height='14' border='0' alt=''></td>

Danke für eure Mühen...

Tom

  1. Hi,

    könnte mir hier jemand vieleicht einen Rat geben wie ich das Script verkleinern kann um die Ladezeiten zu schonen?

    reduziere es auf:

    //Navigation
    hlight_off = new Image();
    hlight_off.src = "img/t_hlight_off.gif";
    hlight_on = new Image();
    hlight_on.src = "img/t_hlight_on.gif";

    Augenscheinlich ist der Rest identisch, Du brauchst dafür also keine speziellen Variablen zu deklarieren.

    Cheatah

    --
    X-Will-Answer-Email: No
    1. Hi,

      könnte mir hier jemand vieleicht einen Rat geben wie ich das Script verkleinern kann um die Ladezeiten zu schonen?

      reduziere es auf:

      //Navigation
      hlight_off = new Image();
      hlight_off.src = "img/t_hlight_off.gif";
      hlight_on = new Image();
      hlight_on.src = "img/t_hlight_on.gif";

      Augenscheinlich ist der Rest identisch, Du brauchst dafür also keine speziellen Variablen zu deklarieren.

      Cheatah

      Danke Cheatah

  2. Hallo,

    ist dir schon aufgefallen, dass du immer die gleichen Bilder lädtst? Da kannst du immer hlight_on und hlight_off benutzen.

    Mit freundlichen Grüßen
       Dmitri Rettig