images w IE i Firefox i innych przegl±darkach

Discussion in 'Javascript' started by K., Apr 20, 2007.

  1. K.

    K. Guest

    Witam!

    Napisalem taka oto funkcje:


    function img_Pokaz(adres,formName,hint_img)
    {
    eval('document.'+formName+'.'+hint_img+'.src = "'+adres+'"');
    }


    i wplotlem go w znacznik img

    <img src="images/Zareczyny.gif" width="165" height="50" alt=""
    usemap="#Mapa_menu_zareczyny" border="0" name="zareczyny"
    onMouseOver="img_Pokaz('images/Zareczyny_kolor.gif','form_glowny','zareczyny');"
    onMouseOut="img_Pokaz('images/Zareczyny.gif','form_glowny','zareczyny');" />


    Problem w tym, ze na IE 7.0. dziala wszystko ok, a na Firefoxie niestety nie
    podmieniaja sie gify i menu daje efekt menu statycznego.

    Jak powinienem zmodyfikowac wiec funkcje img_Pokaz by dostosowac ja do
    wszystkich przegladarek?

    Z gory dzieki za posta
    Pozdrawiam
    M.
    K., Apr 20, 2007
    #1
    1. Advertising

  2. K.

    K. Guest

    U¿ytkownik "K." <> napisa³ w wiadomo¶ci
    news:f09s70$kvr$...
    > Witam!
    >
    > Napisalem taka oto funkcje:
    >
    >
    > function img_Pokaz(adres,formName,hint_img)
    > {
    > eval('document.'+formName+'.'+hint_img+'.src = "'+adres+'"');
    > }
    >
    >
    > i wplotlem go w znacznik img
    >
    > <img src="images/Zareczyny.gif" width="165" height="50" alt=""
    > usemap="#Mapa_menu_zareczyny" border="0" name="zareczyny"
    > onMouseOver="img_Pokaz('images/Zareczyny_kolor.gif','form_glowny','zareczyny');"
    > onMouseOut="img_Pokaz('images/Zareczyny.gif','form_glowny','zareczyny');"
    > />
    >
    >
    > Problem w tym, ze na IE 7.0. dziala wszystko ok, a na Firefoxie niestety
    > nie podmieniaja sie gify i menu daje efekt menu statycznego.
    >
    > Jak powinienem zmodyfikowac wiec funkcje img_Pokaz by dostosowac ja do
    > wszystkich przegladarek?
    >
    > Z gory dzieki za posta
    > Pozdrawiam
    > M.
    >


    Here is the transaltion of my problem
    Hello!

    I wrote such Javascript function:

    function img_Show(adres,formName,hint_img)
    {
    eval('document.'+formName+'.'+hint_img+'.src = "'+adres+'"');
    }


    and added into img element:

    <img src="images/Zareczyny.gif" width="165" height="50" alt=""
    usemap="#Mapa_menu_zareczyny" border="0" name="zareczyny"
    onMouseOver="img_Show('images/Zareczyny_kolor.gif','form_glowny','zareczyny');"
    onMouseOut="img_Show('images/Zareczyny.gif','form_glowny','zareczyny');" />


    There is a problem because it works fine in IE 7.0., but on Firefox not fine
    and there are
    no replace for gif on menu and it gives such effect that menu is static


    How should look like img_Show function to fit it into all web browsers?

    Thank you in advance for post
    Cheers
    M.
    K., Apr 20, 2007
    #2
    1. Advertising

  3. K.

    Guest

    Hello K,

    > function img_Show(adres,formName,hint_img)
    > {
    > eval('document.'+formName+'.'+hint_img+'.src = "'+adres+'"');
    >
    > }


    Maybe try this:

    document.getElementByName(hint_img).src = adres;

    Not tested, but I think it works in all new browsers (DOM).

    greetz, Ralf...
    , Apr 20, 2007
    #3
  4. K.

    K. Guest

    U¿ytkownik <> napisa³ w wiadomo¶ci
    news:...
    > Hello K,
    >
    >> function img_Show(adres,formName,hint_img)
    >> {
    >> eval('document.'+formName+'.'+hint_img+'.src = "'+adres+'"');
    >>
    >> }

    >
    > Maybe try this:
    >
    > document.getElementByName(hint_img).src = adres;
    >
    > Not tested, but I think it works in all new browsers (DOM).
    >
    > greetz, Ralf...
    >



    Unfortunately it doesn`t work either.

    Marcin
    K., Apr 20, 2007
    #4
  5. K.

    Guest

    Hello K,

    > Unfortunately it doesn`t work either.


    Okay, I tried it now with not 'name', but 'id'.

    Use the ID-attribut in the img element and use the getElementById()
    function.
    like: <img src='...' id='zareczyny' ...>

    document.getElementById('zareczyny').src = varValue;

    It works with .alt, I think also with .src .

    have a nice day!
    , Apr 20, 2007
    #5
  6. K.

    K. Guest

    Uzytkownik <> napisal w wiadomosci
    news:...
    > Hello K,
    >
    >> Unfortunately it doesn`t work either.

    >
    > Okay, I tried it now with not 'name', but 'id'.
    >
    > Use the ID-attribut in the img element and use the getElementById()
    > function.
    > like: <img src='...' id='zareczyny' ...>
    >
    > document.getElementById('zareczyny').src = varValue;
    >
    > It works with .alt, I think also with .src .
    >
    > have a nice day!
    >


    It doesn`t work for both getElementById and getElementByName.

    I think I shoul do this by adding some CSS service.

    Have a nice day too
    Marcin
    K., Apr 20, 2007
    #6
  7. K.

    Guest

    > It doesn`t work for both getElementById and getElementByName.

    Don't know what's wrong with your code, but I used your snippet and
    added it to an example html-file.
    It works fine.

    take a look at: http://www.wonderer.de/test/img_over.html

    greetz...
    , Apr 20, 2007
    #7
  8. K.

    MZ Guest

    Uzytkownik <> napisal w wiadomosci
    news:...
    >> It doesn`t work for both getElementById and getElementByName.

    >
    > Don't know what's wrong with your code, but I used your snippet and
    > added it to an example html-file.
    > It works fine.
    >
    > take a look at: http://www.wonderer.de/test/img_over.html
    >
    > greetz...
    >



    Thank you for help.
    It works now.
    I had to change maps positions for Firefox, and set different for IE.
    Here is me result:

    http://www.slub.zmyslowski.pl/

    Thank you Ralf
    Marcin
    MZ, Apr 21, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    4
    Views:
    884
    Eliyahu Goldin
    Jan 4, 2005
  2. Luis Esteban Valencia Muñoz
    Replies:
    0
    Views:
    756
    Luis Esteban Valencia Muñoz
    Jun 3, 2005
  3. wardemon

    Cache Images vs Static Images

    wardemon, Jun 14, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    648
    bruce barker
    Jun 14, 2007
  4. Keith Hughitt
    Replies:
    6
    Views:
    1,060
  5. Adrienne Boswell
    Replies:
    1
    Views:
    499
    dorayme
    Aug 4, 2009
Loading...

Share This Page