Antworten auf deine Fragen:
Neues Thema erstellen

Antworten zum Thema „JS Bermerkungsfeld mit Zeitstempel“

CrawlerSkiline

Nicht mehr ganz neu hier

Hallo allerseits,

Ich habe ein Problem und hoffe ich kann mich wieder auf eure Hilfe verlassen
wie bisher immer. :)

Ich habe ein Bermerkungsfeld in einem Ticketsystem. Wenn man ein Ticketsystem
bearbeiten möchte läd er natürlich den Inhalt dieses Feldes. Ich möchte gerne
erreichen das wenn der Nutzer auf das Bermerkungsfeld klickt der Cursor ans
Ende des Feldes springt und einen Zeitstempel vorher reinschreibt.

Ich habe leider null ahnung wie ich das anstellen soll.

Hoffe ihr könnt mir helfen.

Danke schonmal euer Ski
 

CrawlerSkiline

Nicht mehr ganz neu hier

AW: JS Bermerkungsfeld mit Zeitstempel

Ich habe in einem anderen Forum hilfe gefunden.

Doch für jeden der das selbe Problem hat hier auch nochmal die Lösung:

Code:
[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]
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Neueste Themen & Antworten

Flatrate für Tutorials, Assets, Vorlagen

Statistik des Forums

Themen
175.189
Beiträge
2.582.077
Mitglieder
67.259
Neuestes Mitglied
SaschMasch1312
Oben