생식 이미지 :
특정 구현 :
1. TextArea 태그 내용
코드 사본은 다음과 같습니다.
<span style = "font-size : 14px;"> <tr>
<td align = "right"valign = "top"> 참고 : </td>
<td> <textArea name = ""id = "idar"cols = ""rows = ""onfocus = "this.classname = 'textArea220l'; this.onmouseout = ''; getAddFocus ( 'warch'); onblur = "this.className = 'textArea220'; this.onMouseOut = function () {this.className = 'textArea220'}; lostAddFocus ( 'warnice');" OnMousEmove = "this.className = 'textArea220lg'"onMouseOut = "this.className = 'textArea220'"> </textArea> </td>
</tr> </span>
2. 초기화를 사용하면 추가 버튼을 클릭 할 때 최대 50 단어를 입력 할 수 있습니다.
코드 사본은 다음과 같습니다.
<span style = "font-size : 14px;"> $ ( "#소개"). val ( "최대 50 단어를 입력 할 수 있습니다");
document.getElementById ( "소개"). style.color = "Grey"; </span>
3. JS 스크립트
코드 사본은 다음과 같습니다.
<span style = "font-size : 14px;"> function getAddfocus (id) {// 추가 작업의 소개 및 메모의 경우 Textarea는 COLL CLEAR 입력 상자를 가져옵니다.
var textArea = document.getElementById (id);
TextRea.Value = "";
textRea.style.color = "Black";
}
function lostAddfocus (id) {// 추가 작업의 소개 및 메모의 경우 Textarea가 초점을 잃고 내용이 비어 있으면 프롬프트 메시지가 표시됩니다.
var textArea = document.getElementById (id);
var textArea_value = textArea.Value;
if (textArea_value == "") {
TextRea.Value = "최대 50 단어를 입력 할 수 있습니다";
TextRea.style.color = "Grey";
}
} </span>
CSDN Friends가 작성한 Textarea Focus 사용에 대한 참조 :
코드 사본은 다음과 같습니다.
<span style = "font-size : 14px;"> 1. 텍스트 상자에는 기본 텍스트가 표시됩니다.
<Textarea> White Dove Boy </textarea>
<Textarea> White Dove Boy </textarea>
2. 마우스로 텍스트 상자를 클릭하면 기본 텍스트가 사라집니다.
<textRea onfocus =”if (value == 'White Dove Boy') {value = ''} "> White Dove Boy </textRea>
<textRea onfocus =”if (value == 'White Dove Boy') {value = ''} "> White Dove Boy </textRea>
3. 마우스를 텍스트 상자로 이동하면 기본 텍스트가 사라집니다.
<TextArea OnMouseOver =”Focus ()”onfocus =”if (value == 'White Dove Boy') {value = ''} "> White Dove Boy </textRea>
<TextArea OnMouseOver =”Focus ()”onfocus =”if (value == 'White Dove Boy') {value = ''} "> White Dove Boy </textRea>
4. 마우스로 텍스트 상자를 클릭하면 기본 텍스트가 사라지고 텍스트 상자 외부의 영역을 클릭하면 기본 텍스트가 다시 나타납니다.
<TextArea onfocus =”if (value == 'White Dove Boy') {value = ''} "onblur ="if (value == '') {value = 'White Dove Boy'} "> White Dove Boy </textRea>
<TextArea onfocus =”if (value == 'White Dove Boy') {value = ''} "onblur ="if (value == '') {value = 'White Dove Boy'} "> White Dove Boy </textRea>
5. 마우스를 텍스트 상자로 이동하고 기본 텍스트가 사라지고 마우스가 텍스트 상자에서 벗어나고 기본 텍스트가 다시 나타납니다.
<TextArea OnMouseOver =”focus ()”onfocus =”if (value == 'white dove boy') {value = ''} "onMouseOut ="blur () "onblur ="if (value == '') {value = 'White Dove'} "> White Dove Boy>
<TextArea OnMouseOver =”focus ()”onfocus =”if (value == 'white dove boy') {value = ''} "onMouseOut ="blur () "onblur ="if (value == '') {value = 'White Dove'} "> White Dove Boy>
6. 마우스로 텍스트 상자를 클릭하면 텍스트 상자의 텍스트가 사라집니다 (기본 텍스트와 나중에 입력 한 텍스트 포함) :
<TextArea onclick =”value = ''”> White Dove Boy </textRea>
<TextArea onclick =”value = ''”> White Dove Boy </textRea>
7. 마우스를 텍스트 상자로 이동하면 텍스트 상자의 텍스트가 사라집니다 (기본 텍스트와 나중에 입력 한 텍스트 포함) :
<TextArea OnMouseOver =”value = ''”> White Dove Boy </textArea>
<TextArea OnMouseOver =”value = ''”> White Dove Boy </textArea>
8. 텍스트 상자를 클릭하고 텍스트 상자에서 모든 텍스트를 선택하십시오.
<TextArea onfocus = "select ()"> White Dove Boy </textRea>
<TextArea onfocus = "select ()"> White Dove Boy </textRea>
9. 마우스를 텍스트 상자로 이동하고 텍스트 상자의 모든 텍스트를 선택하십시오.
<TextArea OnMouseOver =”Focus ()”onfocus =”select ()”> White Dove Boy </textRea>
<TextArea OnMouseOver =”Focus ()”onfocus =”select ()”> White Dove Boy </textRea>
10. 입력 후 초점은 현재 텍스트 상자에서 다음 텍스트 상자로 전송됩니다.
<TextArea OnKeyDown =”if (event.KeyCode == 13) event.keyCode = 9 ″> White Dove Boy </textRea>
<TextArea OnKeyDown =”if (event.KeyCode == 13) event.keyCode = 9 ″> White Dove Boy </textRea>
11. 입력 후 초점은 현재 텍스트 상자에서 지정된 위치로 전송됩니다.
<TextArea OnKeypress = "return focusNext (이, '지정된 위치 ID 이름', 이벤트)"> White Dove Boy </textRea> </span>