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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.