The example of this article is about the method of obtaining the content of text box by the DIV layer in the Input text page of JS implementation text box. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> text box input text, page div layer sync get text box content </title>
<style>
textarea{width:300px;height:150px border:1px solid #CCC; font-size:12px; color: #000;}
p{padding-left:30px; text-indent:-30px;width:270px;height:250px; border:1px solid #900; margin-top:50px; font-size : 12px; Color: #F00; line-height:21px; Overflow:hidden}
</style>
<script type= "Text/javascript" >
function Swaptxt ()
{
var txt = document.getElementById ("EML"). Value;
document.getElementById ("Lyny"). Innerhtml=txt;
}
</script>
<body>
<textarea name= "" cols= "rows=" "class=" Loe_hk10 "id=" eml "onkeyup=" Swaptxt () "></textarea>
<p id= "Lyny" > Code home Hint: Please enter text in the text box above, such as www.jb51.net</p>
</body>
The
wants this article to help you with your JavaScript programming.