Status

RESOLVED INVALID
17 years ago
7 years ago

People

(Reporter: lcool, Assigned: ashuk)

Tracking

Trunk
x86
Windows 98

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

17 years ago
Won't run this script which makes images appear to be underwater.







<html>
<!--
  <APPLET archive="DuriusWaterPic.jar" code="DuriusWaterPic.class" HEIGHT="38"
WIDTH="70" ALIGN=CENTER>
    <PARAM name="cabbase" value="DuriusWaterPic.cab">
    <PARAM name="image" value="t_wx.gif">
    <PARAM name="dotsize" value="5">
    <PARAM name="ndotsize" value="0">
    <PARAM name="dim" value="6">
    <PARAM name="delay" value="100">
    <PARAM name="noise" value="0">
    <PARAM name="mouse" value="1">
    <PARAM name="url" value="http://www.washingtontimes.com/weather">
    <PARAM name="bg" value="000000">
    <PARAM name="reg" value="43752326">
  </APPLET>

-->

<script language="JavaScript">

<!--
function MM_preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = MM_preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if
(imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}

function MM_swapImgRestore() { //v2.0
  if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
}

function MM_swapImage() { //v2.0
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = MM_swapImage.arguments[i+2];
  } }
  document.MM_swapImgData = swapArray; //used for restore
}

//-->

</script>
Sorry, this is not a bug... based on the incomplete script you have there it
looks like Mozilla is detected as "Netscape" based on navigator.appName.  Then
since document.layers is null in Mozilla we fall into the body of the "if"
statement and set objStr to document.something.

Then we eval the document.something and this part breaks, since you cannot
access images that way in Mozilla.

Just fixing that part of the code to use the W3C DOM and get images using
getElementById should fix this problem.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → INVALID
Component: Java APIs for DOM → Java APIs for DOM
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.