Quelle: http://l4x.org/Story/261 Und ein herzliches Dankeschön an Jan Dittmer!
contenido/includes/include.mod_edit_form.php:
Unter
Code: Alles auswählen
$input->updateAttributes(array("wrap" => "off"));
$output->updateAttributes(array("wrap" => "off"));
Code: Alles auswählen
$input->setEvent("onkeydown", "return insertTab(event,this);");
$input->setEvent("onkeyup", "return insertTab(event,this);");
$input->setEvent("onkeypress", "return insertTab(event,this);");
$output->setEvent("onkeydown", "return insertTab(event,this);");
$output->setEvent("onkeyup", "return insertTab(event,this);");
$output->setEvent("onkeypress", "return insertTab(event,this);");
Code: Alles auswählen
$form2->custom["submit"]["accesskey"] = '';
Code: Alles auswählen
$sAddTab = '<script type="text/javascript">
<!--
/**
* Insert a tab at the current text position in a textarea
* Jan Dittmer, jdittmer@ppp0.net, 2005-05-28
* Inspired by http://www.forum4designers.com/archive22-2004-9-127735.html
* Tested on:
* Mozilla Firefox 1.0.3 (Linux)
* Mozilla 1.7.8 (Linux)
* Epiphany 1.4.8 (Linux)
* Internet Explorer 6.0 (Linux)
* Does not work in:
* Konqueror (no tab inserted, but focus stays)
*/
function insertTab(event,obj) {
var tabKeyCode = 9;
if (event.which) // mozilla
var keycode = event.which;
else // ie
var keycode = event.keyCode;
if (keycode == tabKeyCode) {
if (event.type == "keydown") {
if (obj.setSelectionRange) {
// mozilla
var s = obj.selectionStart;
var e = obj.selectionEnd;
obj.value = obj.value.substring(0, s) +
"\t" + obj.value.substr(e);
obj.setSelectionRange(s + 1, s + 1);
obj.focus();
} else if (obj.createTextRange) {
// ie
document.selection.createRange().text="\t"
obj.onblur = function() { this.focus(); this.onblur = null; };
} else {
// unsupported browsers
}
}
if (event.returnValue) // ie ?
event.returnValue = false;
if (event.preventDefault) // dom
event.preventDefault();
return false; // should work in all browsers
}
return true;
}
//--></script>';
$page->addScript("addTab", $sAddTab);
Bitte um Feedback, ob das was Schönes ist...
Gruß
HerrB