Here is parts to the date class
function month_selection($selected_month,$submit = null,$month_as_num =
null, $auto_complete = null,$tab_index = null, $disabled = null) {
if ($submit) $submit = "onChange=\"this.form.submit
();return false;\"";
if ($auto_complete) $auto_complete
= "onfocus=\"this.keyInput = '';\" onkeypress=\"var keyCode =
event.keyCode ? event.keyCode : event.charCode; this.keyInput +=
String.fromCharCode(keyCode); selectMatch(this, this.keyInput);return
false;\"";
if ($tab_index) $tab_index = "tabindex=\"$tab_index\"";
if ($disabled) $disabled = "disabled=\"true\"";
$option = "\n\t\t\t\t\t\t\t\t<select name = \"".$this-
>start."month\" onkeydown=\"prevent_backspace();\" $submit $auto_complete
$tab_index $disabled>";
$option .= "\n\t\t\t\t\t\t\t\t\t".'<option></option>';
for ($x=1;$x<13;$x++){
$x==$selected_month ? $selected = "selected" :
$selected = "";
$option .= "\n\t\t\t\t\t\t\t\t\t<option $selected
value='" . date("m", mktime(0,0,0,$x,1,0)) . "'>" . date
($month_as_num ? "m" : "F",mktime(0,0,0,$x,1,0)) . "</option>";
}
$option .= "\n\t\t\t\t\t\t\t\t</select>";
return $option;
}
and the function to peice the form together
function date_form($start = null,$date = null,$field = null,$default =
null,$auto_complete = null,$tab_index = null,$month_as_num = null,$disabled
= null) {
if ($field) { $this->start = $field."_";
} else {
$start==true ? $this->start = "start_" : $this->start
= "end_";
}
if ($date) {
$this->selected_day = date("d",strtotime($date));
$this->selected_month = date("m",strtotime($date));
$this->selected_year = date("Y",strtotime($date));
} elseif ($default) {
unset($this->selected_day);
unset($this->selected_month);
unset($this->selected_year);
}
$date = $this->day_selection($this-
>selected_day,$auto_complete,$tab_index,$disabled);
$date .= $this->month_selection($this-
>selected_month,false,$month_as_num,$auto_complete,$tab_index +
1,$disabled);
$date .= $this->year_selection($this-
>selected_year,false,$auto_complete,$tab_index + 2,$disabled);
return $date;
}
its seems to slow down the page, what could i do for this ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php