I have 2 nested with statements each one has a createElemet function, it runs correctly in every browser except IE9, in IE9 it doesn’t even give a error, what’s the problem?
the code:
with(block = document.createElement('div')){
with (detaildiv = document.createElement('div'))
{
alert('test');
}
}
As I have already mentioned in a comment, I found a very simple solution:
Use
window.document.***instead of directly usingdocument.***in innerwiths:You should also consider refactoring your code and replacing the
withstatements by other constructs.