Hello & thank you for reading.
I have a page which produces a calendar which allows users to edit information on each date. To keep it as streamlined & quick to download as possible (or just a bit more streamlined) I'm wondering which of these works better or if there's any real difference.
while ( $day_num <= $days_in_month )
{
//And then skipping ahead part of the data for each individual day is:
echo "<input type=\"submit\" value=\"Edit\" id=\"editbutton".$day_num."\" class=\"editbutton\" onclick=\"
if (x==0)
{
document.getElementById('storename".$day_num."').readOnly = false;
document.getElementById('location".$day_num."').readOnly = false;
document.getElementById('mileage".$day_num."').readOnly = false;
document.getElementById('mileagebits".$day_num."').style.visibility = 'visible';
document.getElementById('fee".$day_num."').readOnly = false;
document.getElementById('feebits".$day_num."').style.visibility = 'visible';
document.getElementById('editbutton".$day_num."').value = 'Save';
document.getElementById('delbutton".$day_num."').style.display = 'none';
document.getElementById('cancbutton".$day_num."').style.display = 'inline';
x=".$day_num.";
return false;
}
if (x!=".$day_num.")
{
alert(' Please SAVE any edited fields before proceeding');
return false;
}
if (x=".$day_num.")
{
return true;
}
\" />";
}
So in the webpage this is written just once and gets reproduced 30 times.
Or would it be better to put all into a function at the start of the page and just call that function each time? Would it make any noticeable difference to users download speeds (particularly on their mobiles).
Many thanks 🙂