Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > images w IE i Firefox i innych przeglądarkach

Reply
Thread Tools

images w IE i Firefox i innych przeglądarkach

 
 
K.
Guest
Posts: n/a
 
      04-20-2007
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.


 
Reply With Quote
 
 
 
 
K.
Guest
Posts: n/a
 
      04-20-2007

Użytkownik "K." <(E-Mail Removed)> napisał w wiadomości
news:f09s70$kvr$(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
 
RalfWeb1@gmx.de
Guest
Posts: n/a
 
      04-20-2007
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...

 
Reply With Quote
 
K.
Guest
Posts: n/a
 
      04-20-2007

Użytkownik <(E-Mail Removed)> napisał w wiadomości
news:(E-Mail Removed) oups.com...
> 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


 
Reply With Quote
 
RalfWeb1@gmx.de
Guest
Posts: n/a
 
      04-20-2007
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!

 
Reply With Quote
 
K.
Guest
Posts: n/a
 
      04-20-2007

Uzytkownik <(E-Mail Removed)> napisal w wiadomosci
news:(E-Mail Removed) ups.com...
> 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


 
Reply With Quote
 
RalfWeb1@gmx.de
Guest
Posts: n/a
 
      04-20-2007
> 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...

 
Reply With Quote
 
MZ
Guest
Posts: n/a
 
      04-21-2007

Uzytkownik <(E-Mail Removed)> napisal w wiadomosci
news:(E-Mail Removed) oups.com...
>> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FIrefox wants top open images in app, not in firefox Evan Platt Computer Support 6 11-17-2008 04:30 AM
DataList with RadioButtons + Images: How to click on the images to activate the radiobutton? Luis Esteban Valencia Muńoz ASP .Net 0 06-03-2005 03:22 PM
Track Images added to images folder and subfolders - send out email alerts ASP .Net 4 01-04-2005 10:01 PM
Tool for converting 12-bit TIFF images to 16-bit TIFF-images? Peter Frank Digital Photography 11 12-13-2004 02:41 AM
Can recover old images from SmartMedia card, but not recent images Stephen Stormont Digital Photography 9 10-20-2003 07:59 PM



Advertisments