Java script & IE 7
-
Please how do i get java script to work on IE 7. the code works fine in Firefox, it the Epoch calendar function that i am using in my project. thanks.
When you have your javascript code working in some browser and not working in other then you need write code to detect browser and then accordingly need to write javascript code. Here is link that help you to write code to detect browser. [http://www.javascriptkit.com/javatutors/navigator.shtml] [http://www.quirksmode.org/js/detect.html]
Thanks, Arindam D Tewary
-
When you have your javascript code working in some browser and not working in other then you need write code to detect browser and then accordingly need to write javascript code. Here is link that help you to write code to detect browser. [http://www.javascriptkit.com/javatutors/navigator.shtml] [http://www.quirksmode.org/js/detect.html]
Thanks, Arindam D Tewary
Hi Arindam, why you need to detect the browser type/version, i think the best practice is to have a javascript code that works(compatible) with all type of browsers .
Regards, Jamil
-
Hi Arindam, why you need to detect the browser type/version, i think the best practice is to have a javascript code that works(compatible) with all type of browsers .
Regards, Jamil
Hi Jamil, Yes, you are correct, the best practice is that one should write a code which is independednt of type of browser. Unfortunately not all javascript is supported by all browser's javascript processing engine. Thats why we need to detect browser type and write code. As in the problem statement says that the person is having a piece of code which is wokring in Mozila and not in IE 7.0, that prompted me to suggest the same. But rule of thumb is definitely as you have mentioned. :)
Thanks, Arindam D Tewary
-
Hi Jamil, Yes, you are correct, the best practice is that one should write a code which is independednt of type of browser. Unfortunately not all javascript is supported by all browser's javascript processing engine. Thats why we need to detect browser type and write code. As in the problem statement says that the person is having a piece of code which is wokring in Mozila and not in IE 7.0, that prompted me to suggest the same. But rule of thumb is definitely as you have mentioned. :)
Thanks, Arindam D Tewary
oh, i see i got your idea. but from my point of view i would prefer to write a code that is compatible with the main browsers (Firefox, IE and Chrome) :)
Regards, Jamil
-
Hi Jamil, Yes, you are correct, the best practice is that one should write a code which is independednt of type of browser. Unfortunately not all javascript is supported by all browser's javascript processing engine. Thats why we need to detect browser type and write code. As in the problem statement says that the person is having a piece of code which is wokring in Mozila and not in IE 7.0, that prompted me to suggest the same. But rule of thumb is definitely as you have mentioned. :)
Thanks, Arindam D Tewary
I agree to you Arindam. There are a lot javascript code that does not run smoothly on all main browsers. So sometime we have to go for detecting the browser and take the steps accordingly. Everytime we can not get all js code that run all the browser, might be one has to pick another approach or rely very less on javascript, and use server side code as much as possible but this is not good for performance point of view. Hope the coming new browser follow the same standards and create less pain for us :)
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
I agree to you Arindam. There are a lot javascript code that does not run smoothly on all main browsers. So sometime we have to go for detecting the browser and take the steps accordingly. Everytime we can not get all js code that run all the browser, might be one has to pick another approach or rely very less on javascript, and use server side code as much as possible but this is not good for performance point of view. Hope the coming new browser follow the same standards and create less pain for us :)
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
Thanks Brij. Nice to have your comment here. :)
Thanks, Arindam D Tewary
-
Thanks Brij. Nice to have your comment here. :)
Thanks, Arindam D Tewary
Your welcome :)
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
Please how do i get java script to work on IE 7. the code works fine in Firefox, it the Epoch calendar function that i am using in my project. thanks.
this is the segment of code; var popup1; window.onload = function() { popup1 = new Epoch('popup1','popup',document.getElementById('txtdateofbirth'),false); }; thanks again.
-
this is the segment of code; var popup1; window.onload = function() { popup1 = new Epoch('popup1','popup',document.getElementById('txtdateofbirth'),false); }; thanks again.
Hi, i see that you are using the Epoch Popup calendar, it is really nice :) which section of the code is not working? because this Popup is compatible with the main browsers . by the way why are you using onfocus="popup1.setTarget(this)"?
Regards, Jamil
-
Hi, i see that you are using the Epoch Popup calendar, it is really nice :) which section of the code is not working? because this Popup is compatible with the main browsers . by the way why are you using onfocus="popup1.setTarget(this)"?
Regards, Jamil
oh i got the reason: It lets you assign a single instance of Epoch to an unlimited number of <INPUT> boxes—all you need to do is add an onFocus() event handler to the box. This saves both memory and reduces your page's load time.
Regards, Jamil
-
oh i got the reason: It lets you assign a single instance of Epoch to an unlimited number of <INPUT> boxes—all you need to do is add an onFocus() event handler to the box. This saves both memory and reduces your page's load time.
Regards, Jamil
pls how do i get it to work with IE 7. this is the .js class code: function Epoch(name,mode,targetelement,multiselect) { this.state = 0; this.name = name; this.curDate = new Date(); this.mode = mode; this.selectMultiple = (multiselect == true); //'false' is not true or not set at all //the various calendar variables //this.selectedDate = this.curDate; this.selectedDates = new Array(); this.calendar; this.calHeading; this.calCells; this.rows; this.cols; this.cells = new Array(); //The controls this.monthSelect; this.yearSelect; //standard initializations this.mousein = false; this.calConfig(); this.setDays(); this.displayYear = this.displayYearInitial; this.displayMonth = this.displayMonthInitial; this.createCalendar(); //create the calendar DOM element and its children, and their related objects if(this.mode == 'popup' && targetelement && targetelement.type == 'text') //if the target element has been set to be an input text box { this.tgt = targetelement; this.calendar.style.position = 'absolute'; this.topOffset = this.tgt.offsetHeight; // the vertical distance (in pixels) to display the calendar from the Top of its input element this.leftOffset = 0; // the horizontal distance (in pixels) to display the calendar from the Left of its input element this.calendar.style.top = this.getTop(targetelement) + this.topOffset + 'px'; this.calendar.style.left = this.getLeft(targetelement) + this.leftOffset + 'px'; document.body.appendChild(this.calendar); this.tgt.calendar = this; this.tgt.onfocus = function () {this.calendar.show();}; //the calendar will popup when the input element is focused this.tgt.onblur = function () {if(!this.calendar.mousein){this.calendar.hide();}}; //the calendar will popup when the input element is focused } else { this.container = targetelement; this.container.appendChild(this.calendar); } this.state = 2; //0: initializing, 1: redrawing, 2: finished! this.visible ? this.show() : this.hide(); } //----------------------------------------------------------------------------- Epoch.prototype.calConfig = function () //PRIVATE: initialize calendar variables { //this.mode = 'flat'; //can be 'flat' or 'popup' this.displayYearInitial = this.curDate.getFullYear(); //the initial year to display on load this.displayMonthInitial = this.curDate.getMonth(); //the initial month to display on