Click here to Skip to main content
15,881,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This code works with IE8 but not newer browsers.
JavaScript
var isNav, isIE
var coll = ""
var styleObj = ""

var zIndex = 2  // Must be larger than our backgrounds

if (parseInt(navigator.appVersion) >= 4) {
  if (navigator.appName == "Netscape") {
    isNav = true
  } else {
    isIE = true
    coll = "all."
    styleObj = ".style"
  }
}

function show(obj) {
  obj.visibility = "visible"
}

function hide(obj) {
  obj.visibility = "hidden"
}

function changeVisibility(Obj,num) {
  var imgobj = eval('document.' + coll + 'image' + num + styleObj)
  
  // If it's one of our backgrounds we don't want to change its
  // zIndex
  //if (num > 22) {
  // if (Obj.checked)
  //    show(imgobj)
  //  else
  //    hide(imgobj)
  // return
  //}
  if (Obj.checked) {
    zIndex++
    setZIndex(imgobj, zIndex)
    show(imgobj)
  } else {
    hide(imgobj)
    zIndex--
  }
}

function setZIndex(obj, zOrder) {
  obj.zIndex = zOrder
}

function openWin(url, name) {
  popupWin = window.open(url, name, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=350,height=120');
}

function openBWin(url) {
 popupWin = window.open(url);
}
Posted
Updated 11-May-15 3:34am
v2
Comments
Kornfeld Eliyahu Peter 11-May-15 9:35am    
Can you show the relevant HTML too?

1 solution

That means that
JavaScript
var imgobj = eval('document.' + coll + 'image' + num + styleObj) 

is returning null. You'll need to figure out why that is. My understanding is eval is evil so I would suggest changing to using jQuery $("#fieldName") or document.getElementById("id"); instead of using eval.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900