The browser does not load a image set with javascript

RESOLVED FIXED

Status

RESOLVED FIXED
17 years ago
4 years ago

People

(Reporter: pabloa, Unassigned)

Tracking

Details

(URL)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020311
BuildID:    2002031115

The main phorum page of this web site use 2 graphics to display the stat of a
message (visible or not visible). The default is not show the message and I put
a graphic.

Well, when you click in it. The message shows and the graphics is replaced for
another one (via javascript). But it doesn't change!

In IE the things work right

I believe that the javascript use standards methods and properties :-)

The problem I think is the 2nd graphic is not loaded. IE load the graphic
*later* when it is setted by javascript code.

I think that mozilla must load all that it need when the page is modified via
javascript: if the code chage the a graphic for another it must be loaded.

Reproducible: Always
Steps to Reproduce:
1. go to http://www.laotraesquina.com.ar/
2. When the phorum page load. Click into the papiro graphic


Actual Results:  The message shows, but the graphic doesn't change

Expected Results:  It'd have to change and load the new graphic setted by
javascript  (I think)
IE load it later and I believe that it must be the expected result because it is
very usefull for intranet/internet applications (with graphics and others html
components)

Comment 1

17 years ago
I'm sort of guessing and the Mozilla people will know for sure, but I think the
problem is with trying to use window.event. Take a look at this page:
http://www.mozilla.org/docs/dom/dom-talk/moz_vs_ie.html

It compares Mozilla to IE and says about Mozilla: "No window.event, and
different interface for event objects"

You are using this type of code to change the image: window.event.srcElement.src

Comment 2

17 years ago
Confirming report.

David's guess is correct. The site only changes the image if the browser
has a |window.event| object. This is an IE-only extension of DOM syntax,
and Mozilla doesn't have it. So in Mozilla, the images never get changed. 

Here is an example from the site. Notice the mostrarOnOff() function
only changes the image under the |if(window.event)| clause. Since
|window.event| evaluates to true in IE, but false in Mozilla, the site
changes the image for IE, but never changes the image for Mozilla -


<img id="{msg_dom_id_text}" src="../images_system/msg_abierto.png"
         width="17" height="17" alt="Ver/Ocultar mensaje" border="0" 
         OnClick="return mostrarOnOff( 'msg_img_1', -1);">


From http://www.laotraesquina.com.ar/laotra/common/funciones.js:
	
function mostrarOnOff(eName, action) 
{
  var elem = buscar(eName)

  if (action == 1) 
    elem.style.display = "inline";

  else if (action == 0)
    elem.style.display = "none";

  else
  {
    if (elem.style.display == "none")
    {
      elem.style.display = "inline";
      if(window.event) <<<---------------------------- THIS IS THE PROBLEM!
        window.event.srcElement.src = "../images_system/msg_cerrado.png";
    }
    else
    {
      elem.style.display = "none";
      if(window.event) <<<---------------------------- THIS IS THE PROBLEM!
        window.event.srcElement.src = "../images_system/msg_abierto.png";
    }
  }
}



Reassigning this to Tech Evangelism, who will contact the site
about this issue -
Assignee: rogerl → momoi
Component: JavaScript Engine → The Americas
Product: Browser → Tech Evangelism
QA Contact: pschwartau → jonrubin
Version: other → unspecified

Updated

17 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 3

16 years ago
*** Bug 147588 has been marked as a duplicate of this bug. ***

Comment 4

16 years ago
same file, different issue

function mostrarImagen( src, max_w, alt)  {
        i = new Image();
        i.src = src;
        if( i.width >  max_w)  { <-- note width==0 for image not loaded yet
                i.width = max_w;
        }
        sw = i.width;

        document.write('<img src="'+src+'" alt="'+alt+'" width="'+sw+'"
align="center">');
}

Comment 5

16 years ago
tech evang june 2003 reorg.
Assignee: momoi → spanish
Component: The Americas → Spanish
QA Contact: jonrubin → spanish

Comment 6

15 years ago
The site has been fixed.
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.