Div align Example : DIV Style : HTML : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP
JavaScript DHTML Home »  HTML   » [  DIV Style  ]   
 



Div align Example

Please note that some example is only working under IE or Firefox.

    
<html>
<head>
<script language="JavaScript">
    function function1() {
        document.all.myDiv.align = "center";
    }
    function function2() {
        document.all.myDiv.align = "justify";
    }
    function function3() {
        document.all.myDiv.align = "left";
    }
    function function4() {
        document.all.myDiv.align = "right";
    }
</script>
</head>
<body>
<div id="myDiv" 
     style="position:absolute; 
            visibility:visible; 
            width:354px; 
            height:122px; 
            background-color:red; 
            border:1px none #000000">
    <span>Span Span Span Span Span Span Span Span Span Span Span Span</span>
</div>
<input type="Button" value="Center" onClick="function1();">
<input type="Button" value="Justify" onClick="function2();">
<input type="Button" value="Left" onClick="function3();">
<input type="Button" value="Right" onClick="function4();">
</body>
</html>

    
      
      
Related examples in the same category
1.  Using the content Editable Property
2.  Using clientHeight and clientWidth Properties








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.