<script> <BR> function Console(width,height,command) <BR> { <BR> var container=document.createElement("div"); <BR> this.container=container; <br><br> container.runtimeStyle.width=(width); <BR> container.runtimeStyle.height=(height); <BR> container.runtimeStyle.margin="0px"; <BR> container.runtimeStyle.backgroundColor="black"; <BR> container.runtimeStyle.fontFamily="Terminal"; <BR> container.runtimeStyle.color="white"; <BR> container.runtimeStyle.fontSize="16px"; <BR> this.output=document.createElement("div"); <BR> container.appendChild(this.output); <BR> container.innerHTML+="js>" <BR> this.input=document.createElement("input"); <BR> container.appendChild(this.input); <BR> this.input.runtimeStyle.backgroundColor="black"; <BR> this.input.runtimeStyle.borderWidth="0px"; <BR> this.input.runtimeStyle.color="white"; <BR> this.input.runtimeStyle.fontFamily="Terminal"; <BR> this.input.runtimeStyle.width="90%" <BR> this.input.runtimeStyle.fontSize="16px" <BR> this.input.runtimeStyle.position="relative"; <BR> this.input.runtimeStyle.top="2px"; <BR> command=command||function(str) <BR> { <br><br> var e; <BR> try{ <BR> var r=eval(str); <BR> } catch(e) { <BR> return "Bad command"; <BR> } <BR> return r; <br><br> } <br><br> this.input.command=function() <BR> { <BR> this.parentNode.childNodes[0].innerHTML+=this.value+'<br/>' <BR> this.parentNode.childNodes[0].innerHTML+=(command(this.value)+"<br/>") <br><br> } <BR> this.input.onkeyup=new Function("e","e=e||event;if(e.keyCode!=13)return;this.command();this.value='';"); <BR> this.appendto=function(parent) <BR> { <BR> parent.appendChild(this.container); <BR> } <BR> container=null; <BR> } <br><br> //var db=new DrawingBoard(100,100) <BR> //db.drawLine([5,5],[36,44],"red") <BR> //document.body.appendChild(db.container); <BR> var c=new Console("100%","100%"); <BR> c.appendto(document.body); <br><br></script>
Déclaration:Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn