[COLOR=#003366][B]
function[/B][/COLOR] setSelectionRange[COLOR=#009900]([/COLOR]input[COLOR=#339933],[/COLOR] selectionStart[COLOR=#339933],[/COLOR] selectionEnd[COLOR=#009900])[/COLOR][COLOR=#009900]{[/COLOR]
[COLOR=#000066][B]if[/B][/COLOR] [COLOR=#009900]([/COLOR]input.[COLOR=#660066]setSelectionRange[/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]
input.[COLOR=#000066]focus[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
input.[COLOR=#660066]setSelectionRange[/COLOR][COLOR=#009900]([/COLOR]selectionStart[COLOR=#339933],[/COLOR] selectionStart[COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#009900]}[/COLOR]
[COLOR=#000066][B]else[/B][/COLOR] [COLOR=#000066][B]if[/B][/COLOR] [COLOR=#009900]([/COLOR]input.[COLOR=#660066]createTextRange[/COLOR][COLOR=#009900])[/COLOR] [COLOR=#009900]{[/COLOR]
[COLOR=#003366][B]var[/B][/COLOR] range [COLOR=#339933]=[/COLOR] input.[COLOR=#660066]createTextRange[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
range.[COLOR=#660066]collapse[/COLOR][COLOR=#009900]([/COLOR][COLOR=#003366][B]true[/B][/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
range.[COLOR=#660066]moveEnd[/COLOR][COLOR=#009900]([/COLOR][COLOR=#3366CC]'character'[/COLOR][COLOR=#339933],[/COLOR] selectionEnd[COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
range.[COLOR=#660066]moveStart[/COLOR][COLOR=#009900]([/COLOR][COLOR=#3366CC]'character'[/COLOR][COLOR=#339933],[/COLOR] selectionStart[COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
range.[COLOR=#660066]select[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#009900]}[/COLOR]
[COLOR=#009900]}[/COLOR]
[COLOR=#003366][B]function[/B][/COLOR] edit[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#009900]{[/COLOR]
[COLOR=#003366][B]var[/B][/COLOR] area [COLOR=#339933]=[/COLOR] document.[COLOR=#660066]getElementById[/COLOR][COLOR=#009900]([/COLOR][COLOR=#3366CC]'fooBar'[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#003366][B]var[/B][/COLOR] now [COLOR=#339933]=[/COLOR] [COLOR=#003366][B]new[/B][/COLOR] Date[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
area.[COLOR=#660066]value[/COLOR] [COLOR=#339933]+=[/COLOR] now.[COLOR=#660066]getDate[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#339933]+[/COLOR] [COLOR=#3366CC]"."[/COLOR] [COLOR=#339933]+[/COLOR] [COLOR=#009900]([/COLOR]now.[COLOR=#660066]getMonth[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#339933]+[/COLOR] [COLOR=#CC0000]1[/COLOR][COLOR=#009900])[/COLOR] [COLOR=#339933]+[/COLOR] [COLOR=#3366CC]"."[/COLOR] [COLOR=#339933]+[/COLOR] now.[COLOR=#660066]getFullYear[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR] [COLOR=#339933]+[/COLOR] [COLOR=#3366CC]":"[/COLOR][COLOR=#339933];[/COLOR]
area.[COLOR=#000066]focus[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
setSelectionRange[COLOR=#009900]([/COLOR]area[COLOR=#339933],[/COLOR] area.[COLOR=#660066]value[/COLOR].[COLOR=#660066]length[/COLOR][COLOR=#339933],[/COLOR]area.[COLOR=#660066]value[/COLOR].[COLOR=#660066]length[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#009900]}[/COLOR]