JavaScript DHTML/Style Layout/Bounds

Материал из Web эксперт
Перейти к: навигация, поиск

"boundingHeight" Example

    
<html>
<body>
<textarea id="myText" cols="70" rows="2" onclick="function1(this);">
Sample text for the document
</textarea>
<button onclick="function1()">Bounding Height</button>
<script language="JavaScript">
    function function1() {
        var m = myText.createTextRange(); 
        alert(m.boundingHeight);
    }
</script> 
</body>
</html>



"boundingLeft" Example

    
<html>
<body>
<textarea id="myText" cols="70" rows="2" onclick="function1(this);">
Sample text for the document</textarea>
<button onclick="function3()">Bounding Left</button>
<script language="JavaScript">
    function function3() {
        var m = myText.createTextRange(); 
        alert(m.boundingLeft);
    }
</script> 
</body>
</html>



"boundingTop" Example

    
<html>
<body>
<textarea id="myText" cols="70" rows="2" onclick="function1(this);">
Sample text for the document</textarea>
<button onclick="function4()">Bounding Top</button>
<script language="JavaScript">
    function function4() {
        var m = myText.createTextRange(); 
        alert(m.boundingTop);
    }
</script> 
</body>
</html>



"boundingWidth" Example

    
<html>
<body>
<textarea id="myText" cols="70" rows="2" onclick="function1(this);">
Sample text for the document</textarea>
<button onclick="function2()">Bounding Width</button>
<script language="JavaScript">
    function function2() {
        var m = myText.createTextRange(); 
        alert(m.boundingWidth);
    }
</script> 
</body>
</html>