Skip to content Skip to sidebar Skip to footer

Javascript Datepicker Issue In Ie11 - Crossobj.visibility="hidden";

Our Application is a dealer based application. This was implemented basically for IE8 browser, now since the dealers are upgrading to IE11, we are facing lot of issues (majorly in

Solution 1:

The problem is that you have IE-specific code in there where you are setting crossobj.

crossobj=(dom)?document.getElementById("calendar").style : ie? document.all.calendar : document.calendar;

In the above line of code, it checks a variable called ie to determine whether the browser is IE, and if so, it runs different code to other browsers.

The problem for you with this code is that IE11 is much more standards-compliant than older IE versions, and thus doesn't need this kind of code at all.

(in fact, even IE8 shouldn't need it in this case; it's clearly aimed at much older versions than that. And I note that you also have browser checks for ns4 in there, which immediately tells me that your original script is very old code)

My advice is to consider replacing this whole code with a more modern and up-to-date calendar control. There are plenty available which will work in all current browsers and should be easy to plug into your site.

If you absolutely must keep the existing code, then the quick and dirty fix is to find the place where it sets the ie variable, and change the browser detection so it only detects IE8 and earlier (or whatever versions work with it, so that IE11 isn't detected as IE and thus acts as a 'normal' browser. This will probably fix the issue at hand, but may have other unintended consequences, so I'd suggest you're better off going through the code and ripping out all the browser detection stuff. My guess is that most of it is entirely unnecessary even for IE8. There may be some rewriting to be done as a result of that, but it's probably not a bad thing given the age of the code.

If you do find yourself needing some browser-specific code, consider using a tool like Modernizr that will detect support for a given feature rather than direct browser detection.

Hope that helps.

Post a Comment for "Javascript Datepicker Issue In Ie11 - Crossobj.visibility="hidden";"