5 Replies - 2982 Views - Last Post: 05 April 2010 - 08:47 AM

#1 Guest_Jon*


Reputation:

Pass getelementbyid a variable in ie8

Posted 05 April 2010 - 07:33 AM

Hi guys,

This should be amazingly simple...just a syntax thing I'm sure but I have a very basic problem.

I have a call to a function passing a variable that has been previously defined:

fadesection(target);


That function does nothing more than sets the opacity of a div, first line for firefox, 2nd line for ie8:

function fadesection(target)
{

	alert(target);

	document.getElementById(target).style.filter="alpha(opacity=40)";
	document.getElementById(target).style.opacity="0.4";
	
}


The alert(); correctly reports the id of the div in question in both ie8 and ff, but only ff sets the opacity, for some reason ie8 just refuses to set the alpha filter when a variable is passed to getElementById. If I define the id of the div in the statement rather than passing a variable, the opacity is set fine:

document.getElementById('divid').style.filter="alpha(opacity=40)";


What have I missed?!?

Cheers

Jon

Is This A Good Question/Topic? 0

Replies To: Pass getelementbyid a variable in ie8

#2 Guest_Jon*


Reputation:

Re: Pass getelementbyid a variable in ie8

Posted 05 April 2010 - 08:33 AM

Looks like there is more to it than this...IE...grrrrrrrr.

Seems that IE refuses to set the opacity of a div with an XMLHttpRequest attached to it....
Was This Post Helpful? 0

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Pass getelementbyid a variable in ie8

Posted 05 April 2010 - 08:35 AM

IE doesn't support that period
Was This Post Helpful? 0
  • +
  • -

#4 Guest_Jon*


Reputation:

Re: Pass getelementbyid a variable in ie8

Posted 05 April 2010 - 08:41 AM

Should it work if I target a div within the one that has the XMLHttpRequest attached to it?
Was This Post Helpful? 0

#5 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Pass getelementbyid a variable in ie8

Posted 05 April 2010 - 08:43 AM

IE doesn't support the filter property at all, it only works with FF and a coupler other browsers
Was This Post Helpful? 0
  • +
  • -

#6 Guest_Jon*


Reputation:

Re: Pass getelementbyid a variable in ie8

Posted 05 April 2010 - 08:47 AM

Ok, so is there a correct syntax for setting opacity because using a filter works in ie8 for a div without an httprequest attached to it?
Was This Post Helpful? 0

Page 1 of 1