2016-02-12 41 views
-2

我嘗試調整一個textarea(形式將由CKEditor的更換要準確),以適應整個頁面,這是我的html代碼:調整textarea的以適合頁面垂直

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8"> 
     <title>A Simple Page with CKEditor</title> 
     <!-- Make sure the path to CKEditor is correct. --> 
     <script src="ckeditor/ckeditor.js"></script> 
    </head> 
    <body> 
     <h1 align="center" style="font-family:Consolas;">AIO HTML WYSIWYG Editor</h1> 
     <form> 
      <textarea name="editor1" id="editor1" rows="50" cols="80"> 

      </textarea> 
      <script> 
       // Replace the <textarea id="editor1"> with a CKEditor 
       // instance, using default configuration. 
       CKEDITOR.replace('editor1'); 
      </script> 
     </form> 
    </body> 
</html> 

這是目前的樣子: Screenshot of the page in firefox 在此先感謝! :)

+0

哪部分代碼嘗試調整大小?我沒看到它。 – csmckelvey

回答

0

我想這取決於你使用的是哪個版本。你看過http://ckeditor.com/addon/maximize嗎?

另外,你可以嘗試的JavaScript調用內置的最大化功能:

<script> 
window.onload = function(){ 
CKEDITOR.on('instanceReady', 
     function(evt) 
     { 
     var editor = evt.editor; 
     editor.execCommand('maximize'); 
     }); 
}; 
</script> 

(注:此代碼張貼所有網站上,我複製專家交流這個特定摘錄)

0

JS:

screen.width; 
screen.height; 

JS:

document.getElementById("someIDofElement").style.width=screen.width-0+'px'; /* -0 not need but if you need you can do -100 or +100 if need*/ 
    document.getElementById("someIDofElement").style.height=screen.height-0+'px'; 
+0

我不知道如何使用它們,請發佈代碼。 – TheDcoder

+0

它不工作... – TheDcoder