Jump to content

Poor performance


cooldude832

Recommended Posts

I have a "growing" div container on a page and for some reason this code is executing really slowly

 

http://kseego.com/e_cal.php

 

that is the demo of it

 

the code running it is

 

function ecal_date_toggle(ecal_day){
if(in_array(ecal_day,ecal_dates_open)){
document.getElementById('ecal_day_'+ecal_day).innerHTML="";
	document.getElementById('ecal_day_'+ecal_day).style.display='none';
	ecal_dates_open[ecal_day] = 0;
}
else{
	maker_date = new Date(ecal_day.substr(0,4)+","+ecal_day.substr(4,2)+","+ecal_day.substr(6));
	maker_date = new Date(ecal_day.substr(0,4)+","+ecal_day.substr(4,2)+","+ecal_day.substr(6));
	ecal_dates_open[ecal_day] = ecal_day;
	var box = "<div id='ecal_day_"+ecal_day+"' class='ecal_dates'>"+maker_date+"  <input type='text' name='ecal_date_start[ecal_day]' value='start time' /><input type='text' name='ecal_date_end[ecal_day]' value='end time' /><img src='/images/icons/delete.png' alt='delete' onclick='cal_date_toggle(ecal_day);' />";
	document.getElementById('ecal_date_toggle').innerHTML=document.getElementById('ecal_date_toggle').innerHTML+box;
}
}

 

basically it checks to see if a div is added, if so then destroy the content in it and set it to off, otherwise write the new div and add it on to the bigger box.

 

any suggestions would be useful.

Link to comment
https://forums.phpfreaks.com/topic/190497-poor-performance/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.