I’m trying to get rid of some javascript errors related to fadein/fade out. If you go to my test site here findmydentalplan.com/signup.php you will see the green ticks and red warning boxes working fine when entering information, but I get 92 (!) errors when checking the error console.
Chrome:
Uncaught TypeError: Cannot read property ‘style’ of null /templates/default/js/core.js:124
Looking in the core.js file I find this
function hide_info(x){
//fades out the info
opacity('infobox_'+x,90,0,1000);
}
function show_info(x){
//fades in the info
opacity('infobox_'+x,0,90,100);
}
function opacity(id, opacStart, opacEnd, millisec){
//sets opacity of an DOM object
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("change_opacity(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++) {
setTimeout("change_opacity(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
}
}
function change_opacity(opacity, id) {
//change opacity (cross browsers)
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}
Line 124 is: var object = document.getElementById(id).style;
I have added some style=“opacity:1; background: white;” properties to my HTML thinking that was the problem, but it makes no difference. Still getting the error related to line 124.
Since my javascript knowledge is minimal and I seem to have a learning-disability for what javascript concerns, I hope some of you more skilled people can tell me what this is about, and what I need to do.
Thanks in advance!