setExpression Method
페이지 정보
작성자 서방님 댓글 0건 조회 142회 작성일 06-09-14 11:01본문
[Syntax] object.setExpression(sPropertyName, sExpression [, sLanguage])
The following syntax sections show how to set an expression on DHTML Properties and CSS attributes.
- Use this syntax to set an expression on a read/write property or on an expando property.
- Use this syntax to set an expression on a CSS attribute.
- Use the expression() syntax to set an expression on a CSS attribute in HTML.
For example, Dynamic HTML (DHTML) can be used to position objects based on the location and measurement of other objects. The following equations are examples for centering an object horizontally or vertically.
- Center the object horizontally:
- Center the object vertically:
---------------------------------------------------------------------------
원하는 내용이 해당줄에서 항상 브라우저의 가운데에만 위치하도록 하는 예제
<SCRIPT> window.onload=fnInit; function fnInit(){ oDiv.style.setExpression("left", "document.body.clientWidth/2 - oDiv.offsetWidth/2" ); oDiv.style.setExpression("top", "document.body.clientHeight/2 - oDiv.offsetHeight/2" ); document.recalc(true); } </SCRIPT>
<DIV ID="oDiv" STYLE="background-color: #CFCFCF; position: absolute; top: 0; left: 0;"> Example DIV </DIV>
댓글목록
등록된 댓글이 없습니다.