Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- var box; var code;
- function init(){
- box = document.getElementById('html_text');
- code = document.getElementById('html_code');
- code.onkeyup = boxCheck;
- }
- String.prototype.indexesOf = function(x){
- var r = [];
- for(var i=0;i<this.length;i++) if(this[i] == x) r.push(i);
- return r;
- }
- function boxCheck(){
- var endLines = code.value.indexesOf('\n');
- box.style.display = '';
- for(var i=0;i<2;i++){
- if(endLines[i+1] == undefined && code.value.length - endLines[i] > 46){
- box.style.display = 'none';
- break;
- }
- if(endLines[i] - endLines[i+1] > 46){
- box.style.display = 'none';
- break;
- }
- }
- if(endLines.length == 0 && code.value.length > 45)
- box.style.display = 'none';
- }
- </script>
- </head>
- <body onload="init();">
- <div id="html_text"><h5 style="
- margin-top: 17px;
- margin-left: 400px;
- position: fixed;
- color: black;
- z-index: 1;
- font-family: Arial, Helvetica, sans-serif;
- border-style: solid;
- border-width: thin;
- padding-left: 5px;
- padding-right: 5px;
- padding-top: 5px;
- padding-bottom: 3px;
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;">HTML</h5></div>
- <textarea rows="20" style="
- margin-left: 20px;
- font-family: 'Courier New', Courier, monospace;
- height: 280px;
- width: 460px;
- resize: none;
- overflow: scroll;
- overflow-x: hidden;
- position: absolute;
- z-index: 0;" id="html_code" spellcheck="false"></textarea>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement