2016-05-26 13 views
0

Ich habe einen Textbereich:HTML - Warum kann ich diesen HTML-Textbereich nicht eingeben?

<textarea name="p_comments" rows="5" cols="39" align="left" wrap="cwrap" onfocus="this.blur()"> 

Wenn ich in dieses Feld eingeben, es tut nichts. Es gibt ein Textfeld direkt daneben, das funktioniert, aber es hat nicht die onfocus="this.blur()" ist das der Schuldige?

Ich habe versucht, dies im Quelltext-Editor zu entfernen, aber ich kann immer noch nicht in die Box eingeben. Ich kann das HTML auf dem Server nicht ändern, also wollte ich sehen, ob die "Unschärfe" die Ursache oder vielleicht die CSS ist?

css:

element.style { 
} 
textarea[Attributes Style] { 
    text-align: left; 
    white-space: pre-wrap; 
    word-wrap: break-word; 
} 
textarea { 
    padding: 2px 0px 0px 2px; 
} 
user agent stylesheet 
input:not([type="image" i]), textarea { 
    box-sizing: border-box; 
} 
textarea { 
    font-family: monospace; 
    border-color: rgb(169, 169, 169); 
} 
textarea { 
    -webkit-appearance: textarea; 
    background-color: white; 
    border-image-source: initial; 
    border-image-slice: initial; 
    border-image-width: initial; 
    border-image-outset: initial; 
    border-image-repeat: initial; 
    -webkit-rtl-ordering: logical; 
    -webkit-user-select: text; 
    flex-direction: column; 
    resize: auto; 
    cursor: auto; 
    border-width: 1px; 
    border-style: solid; 
} 
input, textarea, keygen, select, button { 
    text-rendering: auto; 
    color: initial; 
    letter-spacing: normal; 
    word-spacing: normal; 
    text-transform: none; 
    text-indent: 0px; 
    text-shadow: none; 
    display: inline-block; 
    margin: 0em 0em 0em 0em; 
    font: 13.3333px Arial; 
} 
input, textarea, keygen, select, button, meter, progress { 
    -webkit-writing-mode: horizontal-tb; 
} 
Inherited from td 
TD { 
    font-family: "Arial"; 
    font-size: 10pt; 
} 
Inherited from table 
table { 
    white-space: normal; 
    line-height: normal; 
    font-weight: normal; 
    font-size: medium; 
    font-variant: normal; 
    font-style: normal; 
    color: -internal-quirk-inherit; 
    text-align: start; 
} 
table { 
    display: table; 
    border-collapse: separate; 
    border-spacing: 2px; 
    border-color: grey; 
} 
Inherited from td 
TD { 
    font-family: "Arial"; 
    font-size: 10pt; 
} 
Inherited from table 
table { 
    white-space: normal; 
    line-height: normal; 
    font-weight: normal; 
    font-size: medium; 
    font-variant: normal; 
    font-style: normal; 
    color: -internal-quirk-inherit; 
    text-align: start; 
} 
table { 
    display: table; 
    border-collapse: separate; 
    border-spacing: 2px; 
    border-color: grey; 
} 



 
 

Antwort

0
onfocus="this.blur()" 

Ja, das ist, wo das Problem herkommt. Wenn Sie dies von devtool entfernen, wird es nichts ändern, da das JavaScript bereits ausgeführt wird, wenn Sie es versuchen.

Die Lösung wäre, diesen Event Listener zu entfernen (ich kann nicht wirklich sehen, wie Sie einen Funktionsnamen benötigen - was Sie nicht haben), oder das Element durch JavaScript in einem anderen Textbereich ersetzen. (Das ist ein bisschen hässlich zu tun, obwohl)

+0

Ah, die Sinn macht, warum es hat sich nicht verändert . Vielen Dank! –

0

onfocus="this.blur()" ist auf jeden Fall der Schuldige. Es versucht, den Textbereich nur lesbar zu machen.

0

entfernen onfocus = "this.blur()" von TextArea-

0

Ok Sie dieses Skript force verwenden kann konzentrieren, um die textarea:

var allEle = document.getElementsByTagName('textarea'); 
for(i=0; i<allEle.length; i++){ 
    var ele = allEle.item(i); 
    focueEle(ele) 
} 

function focueEle(ele){ 
    ele.onfocus = function() { 
     ele.focus(); 
    } 
} 

https://jsfiddle.net/b6pshw0m/2/

Verwandte Themen