Select/Unselect text in TextArea with a MouseOverTag(s): Form
When the mouse is over the textarea, "your comment" is selected. If the user starts typing, "comment here" is erased. The DIV is for IE, LAYER is for Netscape.
<SCRIPT>
function changeSelect(flag) {
if (flag == 1) {
if (document.theForm.comments.value ==
document.theForm.comments.defaultValue) {
document.theForm.comments.select();
}
}
if (flag == 2) {
document.theForm.comments.value =
document.theForm.comments.value;
}
}
</SCRIPT>
<P>
<DIV onMouseOver="changeSelect(1);"
onMouseOut="changeSelect(2);">
<LAYER onMouseOver="changeSelect(1);"
onMouseOut="changeSelect(2);">
<FORM name="theForm">
<TEXTAREA NAME="comments"
COLS="30" ROWS="4">Your comments</TEXTAREA>
</FORM>
</LAYER>
</DIV>
</P>
Try it:
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com