setExpression Method > html

본문 바로가기
사이트 내 전체검색

html

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:
The following example shows how to set the expressions inline.
---------------------------------------------------------------------------
원하는 내용이 해당줄에서 항상 브라우저의 가운데에만 위치하도록 하는 예제
<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>

댓글목록

등록된 댓글이 없습니다.

Total 323건 20 페이지
게시물 검색

회원로그인

접속자집계

오늘
84
어제
190
최대
1,347
전체
167,492
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.