Jump to content

IE sucks!


aspnetguy
 Share

Recommended Posts

I found a bug in IEI tried using setAttribute("style", cssStyles);and it does not work in IE. So I had to use the ugly work around like this

  var theDiv = document.createElement('div');  theDiv.setAttribute('id','cropArea');  imgParent.appendChild(theDiv);	  var cropAreaDiv = document.getElementById('cropArea');  cropAreaDiv.style.border = '1px dashed #000';  cropAreaDiv.style.background = '#dedede';  cropAreaDiv.style.filter = 'alpha(opacity=50)';  cropAreaDiv.style.position = 'absolute';  cropAreaDiv.style.top = y1.value + 'px';	  cropAreaDiv.style.left = x1.value + 'px';  cropAreaDiv.style.width = dw + 'px';	  cropAreaDiv.style.height = dh + 'px';

instead of just 2 lines like this

var cssStyle = "..the styles...";theDiv.setAttribute("style", cssStyles);

Man I hate IE. Is there a cleaner work around???Thanks.

Link to comment
Share on other sites

You fellows are funny..And I thought the "O" was for Opera :) Maybe this will help with the problem,

<html>  <head>  <title></title>  <script type="text/javascript">  function mkDiv(){  var cssStyle = "position: absolute; top: 150px; left: 50px;";  if(window.ActiveXObject){    var nDiv = document.createElement('<div style="' + cssStyle + '">');    }    else {    var nDiv = document.createElement('DIV');    nDiv.setAttribute('style', cssStyle);        }  var nText = document.createTextNode('This is our new div');  nDiv.appendChild(nText);  document.getElementById('holder').appendChild(nDiv);  }  window.onload = mkDiv;  </script>  </head>  <body>  <div id="holder">  </div>  </body></html>

Please join: FFSCIE(Folks For Standards Compliant IE)

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...