function addTimeRange(from,to) {
var tstampFrom;
var tstampTo;
arrFrom = from.split(":");
arrTo = to.split(":");
if (document.serviceAdd.servTimeFromM.options[document.serviceAdd.servTimeFromM.selectedIndex].text == "pm") { (arrFrom[0] += 12); }
if (document.serviceAdd.servTimeToM.options[document.serviceAdd.servTimeToM.selectedIndex].text == "pm") { (arrTo[0] += 12); }
tstampFrom = arrFrom[0]+':'+arrFrom[1]+':00';
tstampTo = arrTo[0]+':'+arrTo[1]+':00';
var opt = document.createElement("option");
opt.text = from+document.serviceAdd.servTimeFromM.options[document.serviceAdd.servTimeFromM.selectedIndex].text+' - '+to+document.serviceAdd.servTimeToM.options[document.serviceAdd.servTimeToM.selectedIndex].text;
opt.value= tstampFrom+' - '+tstampTo;
document.getElementByID("servTimeRange").options.add(opt);
}
Problem is just on the last line of the last group of code here, giving me the "object does not support this property or method" message - and it looks right to me, so probably needs a fresh pair of eyes.
I've also noticed that on the line "arrFrom[0] += 12", that despite the value in this array is a number, it's concatenating it - what's the best way to convert that value to an integer?
Malgrim, Thank you!! The case-sensitivity was all it was.
Yeah, I've been confused by the method before as I've been able to use it on objects without an ID attribute... The name has always sufficed for me before.
Bookmarks