标签:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> #a{width: 90%;height: 400px; overflow: scroll; border: 1px black solid; position: relative; } li{margin-top: 10px;overflow: hidden} #huifu{position: absolute;right: 20px;bottom:20px} p{margin-left: 30px} </style> </head> <body> <div class="all"> <ul id="a"> <li id="b">天猫<br/> 如果你有意见和建议求留言</li> <li id="huifu">留言</li> </ul>
</div>
</body> <script type="text/javascript"> var a=document.getElementById("a"); var b=document.getElementById("b"); var c=document.createElement("textarea"); var d=document.createElement("input"); var e=document.createElement("input"); e.setAttribute("type","text"); d.setAttribute("type","submit"); huifu.onclick=function(){ a.appendChild(e); a.appendChild(c); a.appendChild(d); e.style.width=""; c.style.width="98%"; d.style.width="40px"; e.style.marginTop="30px"; c.value=""; e.value=""; }; d.onclick=function(){ var f= c.value; var w= e.value;
var time2=document.createElement("small"); var time3=document.createTextNode(Date()); var h=document.createElement("p"); var w2=document.createElement("li"); var w3=document.createElement("small");
var i=document.createTextNode(f); var w1=document.createTextNode(w); time2.style.float="right"; time2.appendChild(time3); w2.appendChild(w1); h.appendChild(i); h.appendChild(time2); a.appendChild(w2); a.appendChild(h);
a.removeChild(c); a.removeChild(d); a.removeChild(e);
}
</script> </html>
标签:
原文地址:http://www.cnblogs.com/dugufeiyang/p/5518661.html