faqts : Computers : Programming : Languages : JavaScript : DHTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

75 of 92 people (82%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I rotate an element by 90, 180, 270 degree?

May 25th, 2001 01:23
Martin Honnen, http://msdn.microsoft.com/workshop/author/filter/reference/properties/Rotation.asp


IE5.5 offers a filter for this, here is an example that allows to 
rotate a div element by 90 degree:
<html>
<head>
<script>
var i = 0;
</script>
</head>
<body>
<input type="button" value="rotate by 90 deg" 
       onclick="i = ++i % 4;
                if (!document.all.aDiv.style.filter)
                   document.all.aDiv.style.filter = 
'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + i + ')';
                            else                 
document.all.aDiv.filters.item('DXImageTransform.Microsoft.BasicImage').
Rotation = i"
/> 
<div id="aDiv"
     style="width: 100px; height: 100px;
            background-color: lime;"
>
<table width="100%" height="100%">
<tr><td align="center" valign="middle">Kibology for all.</td></tr>
</table>
</div>
</body>
</html>